[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

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


FITS_TEST_CHECKSUM() Source code in fits_test_checksum.pro

FITS_TEST_CHECKSUM()

Name
    FITS_TEST_CHECKSUM()
Purpose
    Verify the values of the CHECKSUM and DATASUM keywords in a FITS header
Explanation
     Follows the 23 May 2002 version of the FITS checksum proposal at
     http://heasarc.gsfc.nasa.gov/docs/heasarc/fits/checksum.html
Calling Sequence
    result = FITS_TEST_CHECKSUM(HDR, [ DATA, ERRMSG=, /FROM_IEEE ])
Input Parameters
    HDR - FITS header (vector string)
OPTIONAL DATA:
    DATA - data array associated with the FITS header.   If not supplied, or
           set to a scalar, then there is assumed to be no data array
           associated with the FITS header.
Returns
     An integer -1, 0 or 1 indicating the following conditions:
           1 - CHECKSUM (and DATASUM) keywords are present with correct values
           0 - CHECKSUM keyword is not present
          -1 - CHECKSUM or DATASUM keyword does not have the correct value
               indicating possible data corruption.
Keyword Parameters
    /FROM_IEEE - If this keyword is set, then the input is assumed to be in
             big endian format (e.g. an untranslated FITS array).    This
             keyword only has an effect on little endian machines (e.g.
             a Linux box).
Optional Keyword Output
     ERRMSG - will contain a scalar string giving the error condition.   If
              RESULT = 1 then ERRMSG will be an empty string.   If this
              output keyword is not supplied, then the error message will be
              printed at the terminal.
Note
     The header and data must be *exactly* as originally written in the FITS
     file.  By default, some FITS readers may alter keyword values (e.g.
     BSCALE) or append information (e.g. HISTORY or an inherited primary
     header) and this will alter the checksum value.
Procedures Used
    CHECKSUM32, FITS_ASCII_ENCODE(), SXPAR()
Example
     Verify the CHECKSUM keywords in the primary header/data unit of a FITS
     file 'test.fits'
     FITS_READ,'test.fits',data,hdr,/no_PDU,/NoSCALE
     print,FITS_TEST_CHECKSUM(hdr,data)
     Note the use of the /No_PDU and /NoSCALE keywords to avoid any alteration
     of the FITS header
Revision History
     W. Landsman  SSAI               December 2002
     Return quietly if CHECKSUM keywords not found W. Landsman May 2003
     Add /NOSAVE to CHECKSUM32 calls when possible W. Landsman Sep 2004

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

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

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