[AstroPy] pyfits: checksum/datasum not both required in fits files

John K. Parejko john.parejko at yale.edu
Wed Sep 4 18:00:04 EDT 2013


Hello,

It looks like the fits checksum proposal does not require both DATASUM and CHECKSUM in the header (2nd paragraph of the PDF):

http://fits.gsfc.nasa.gov/registry/checksum.html

verify_checksun in pyfits 3.1.2 does not calculate a matching checksum if "CHECKSUM" is present, but "DATASUM" is not, because it assumes datasum is 0. If I pre-compute datasum and pass that to hdu._calculate_checksum(), I do get the matching checksum.

This problem came up because we have some data written with nom.tam.fits v1.06.0, which only writes CHECKSUM, not DATASUM. We've hacked around it when reading the data with pyfits, but it'd be nice to not need that hack. Unfortunately, the correct behavior seems unspecified in the proposal, in the case where CHECKSUM is present but DATASUM is not.

Should pyfits relax this requirement, and attempt to pre-compute the data checksum before calling _calculate_checksum(), instead of assuming 0?

John

--
*************************
John Parejko
john.parejko at yale.edu
http://www.astro.yale.edu/~jp727/
203 432-9759
JWG 465
Department of Physics
Yale University
New Haven, CT
**************************









More information about the AstroPy mailing list