[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


CHECK_FITS Source code in check_fits.pro

CHECK_FITS

Name
       CHECK_FITS
Purpose
       Check that keywords in a FITS header array match the associated data
Explanation
       Given a FITS array IM, and a associated FITS or STSDAS header HDR, this
       procedure will check that
               (1) HDR is a string array, and IM is defined and numeric
               (2) The NAXISi values in HDR are appropriate to the dimensions
                   of IM
               (3) The BITPIX value in HDR is appropriate to the datatype of IM
       If HDR contains a DATATYPE keyword (as in STSDAS headers), then this is
       also checked against the datatype of of IM
       If the /UPDATE keyword is present, then the FITS header will be
       modified, if necessary, to force agreement with the image array
Calling Sequence
       check_FITS, im, hdr, [ dimen, idltype, /UPDATE, /NOTYPE, /SDAS, /SILENT
                              ERRMSG = ]'
Input Parameters
       IM -  FITS (or STSDAS) array, e.g. as read by READFITS
       HDR - FITS (or STSDAS) header (string array) associated with IM
Optional Output
       dimen - vector containing actual array dimensions
       idltype- data type of the FITS array as specified in the IDL SIZE
               function (1 for BYTE, 2 for INTEGER*2, 3 for INTEGER*4, etc.)
Keyword Parameters
       /NOTYPE - If this keyword is set, then only agreement of the array
               dimensions with the FITS header are checked, and not the
               data type.
       /UPDATE - If this keyword is set then the BITPIX, NAXIS and DATATYPE
               FITS keywords will be updated to agree with the array
       /SDAS - If this keyword is set then the header is assumed to be from
               an SDAS (.hhh) file.    CHECK_FITS will then ensure that (1)
               a DATATYPE keyword is included in the header and (2) BITPIX
               is always written with positive values.
       /FITS -  If this keyword is present then CHECK_FITS assumes that it is
               dealing with a FITS header and not an SDAS header, see notes
               below.
       /SILENT - If keyword is set and nonzero, the informational messages
               will not be printed
Optional Keyword Output
       ERRMSG  = If this keyword is present, then any error messages will be
                 returned to the user in this parameter rather than
                 depending on the MESSAGE routine in IDL.  If no errors are
                 encountered, then a null string is returned.
;
Procedure
       Program checks the NAXIS1 and NAXIS2 parameters in the header to
       see if they match the image array dimensions.
Note
       An important distinction between an STSDAS header and a FITS header
       is that the BITPIX value in an STSDAS header is always positive,
       e.g. BITPIX=32 for REAL*4 data.    Users should use either the /SDAS
       or the /FITS keyword if it is important whether the STSDAS or FITS
       convention for REAL*4 data is used.     Otherwise, CHECK_FITS assumes
       that if a DATATYPE keyword is present then it is dealing with an
       STSDAS header.
Procedures Used
       STRN(),FXADDPAR, fxpar()
Revision History
       Written, December 1991  W. Landsman Hughes/STX to replace CHKIMHD
       No error returned if NAXIS=0 and IM is a scalar   W. Landsman  Feb 93
       Fixed bug for REAL*8 STSDAS data W. Landsman July 93
       Make sure NAXIS agrees with NAXISi  W. Landsman  October 93
        Converted to IDL V5.0   W. Landsman   September 1997
       Allow unsigned data types   W. Landsman December 1999
       Allow BZERO = 0 for unsigned data types   W. Landsman January 2000
       Added ERRMSG keyword, W. Landsman February 2000
       Use FXADDPAR to put NAXISi in proper order   W. Landsman August 2000
       Improper FXADDPAR call for DATATYPE keyword  W. Landsman December 2000
       Remove explicit setting of obsolete !err W. Landsman February 2004

Last modified by pro2html on 2005 January 22 at 17:19 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically