BasicFITS.h
Classes
- Global Functions -- read a FITS file from an AIPS++ array (full description)
- Global Functions -- write a FITS file to an AIPS++ array (full description)
Interface
- Array<Float> ReadFITS(const char *FileName, Bool &ok, String &ErrorMessage, String *unitName = 0, Vector<String> *axisNames = 0, Vector<Float> *refPixel = 0, Vector<Float> *refLocation = 0, Vector<Float> *delta = 0, Map<String, Double> *keywords = 0, String *objectName = 0)
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Motivation
Quick and dirty interface to the FITS classes for turning aips++
arrays into FITS files and back. N.B. this will have many more features
in the future, also some files should be renamed since we now have
FITS.h and fits.h.
Synopsis
Read FITS from a file into an aips++ Array. Sets "ok" to False if there
is any problem. We only deal with data in the primary data array.
If ReadFITS fails, the state of array is undefined. Trailing
degenerate (length==1) axes are NOT removed. If desired, you may do
this yourself with the nonDegenerate array member function.
If ok is false, ErrorMessage will contain an information error message.
If necessary, the data is converted from whatever type it is stored as
to Float. BSCALE and BZERO are applied. Blanks are not handled.
If unitName is non-null, the string it points to is filled with the FITS
BUNIT keyword. If axisNames is name of the axes (CTYPEn).
If refPixel is non-null, it is set to the reference pixel of the FITS file
(CRPIX). Similarly refLocation is set to the position
(image coordinates) of the reference pixel (CRVALn) and delta is
set to the increment along each axis (CDELTn). All
the vectors are resized if necessary. Note that FITS pixel indexing is
one-based, AIPS++ is 0-based, this correction is made. unitName and
axisNames have trailing blanks (a FITS "feature") removed.
If "keywords" is non-null, the integral and floating point keywords
(excluding NAXIS*, BSCALE, BZERO) are read into keywords. Case is not
changed.
If objectName is non-null, the string it points to is set to the
value of the FITS OBJECT keyword.
This will only work properly on an IEEE big-endian
machine at the moment.
Member Description
Array<Float> ReadFITS(const char *FileName, Bool &ok, String &ErrorMessage, String *unitName = 0, Vector<String> *axisNames = 0, Vector<Float> *refPixel = 0, Vector<Float> *refLocation = 0, Vector<Float> *delta = 0, Map<String, Double> *keywords = 0, String *objectName = 0)
blabla
Interface
- Bool WriteFITS(const char *FileName, const Array<Float> &array, String &ErrorMessage, const char *unitName = 0, const Vector<String> *axisNames = 0, const Vector<Float> *refPixel = 0, const Vector<Float> *refLocation = 0, const Vector<Float> *delta = 0, const Map<String, Double> *keywords = 0, const char *objectName = 0, Int BITPIX=-32, Float minPix = 1.0, Float maxPix = -1.0)
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
Synopsis
Write a FITS file from an aips++ Array. Returns False if there is any
proglem. The data is written into the primary data array, and the data
is written in floating point (BITPIX=-32). If the operation fails,
ErrorMessage will contain an informative error. At the moment this
probably isn't bulletproof enough at finding errors on output.
If any of unitName, axisNames, refPixel, refLocation, or delta are
non-null, the corresponding FITS keywords (BUNIT, CTYPEn, CRPIXn,
CRVALn, CDELTn) are set. CRVALn is corrected for the difference in
addressing between FITS and AIPS++ (1 vs. 0). If a Vector pointer
is non-null, then that vector must be the correct length.
If keywords is non-null, the contents are written out as FITS keywords.
The names are upper-cased and truncated to 8 characters (yuck). No other
validation is done (e.g. that SIMPLE or NAXIS is not in the map).
If objectName is non-null, the OBJECT keyword is set.
BITPIX can presently be set to -32 or 16 only. When BITPIX is 16 it will
write BSCALE and BZERO into the FITS file. If minPix is greater than maxPix
the minimum and maximum pixel values will be determined from the array,
otherwise the supplied values will be used and pixels outside that range
will be truncated to the minimum and maximum pixel values (note that this
truncation does not occur for BITPIX=-32).
Member Description
Bool WriteFITS(const char *FileName, const Array<Float> &array, String &ErrorMessage, const char *unitName = 0, const Vector<String> *axisNames = 0, const Vector<Float> *refPixel = 0, const Vector<Float> *refLocation = 0, const Vector<Float> *delta = 0, const Map<String, Double> *keywords = 0, const char *objectName = 0, Int BITPIX=-32, Float minPix = 1.0, Float maxPix = -1.0)
blabla