You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the addition of lazy loading, checksum are verified only for the primary HDU when opening the file, and the other HDUs are verified only when (and if) there are loaded. So if an invalid HDU is not explicitly loaded, it will not be verified.
I think this is wrong, and specifying checksum=True in fits.open should load all HDUs to verify them. The documentation also states that opening is enough to verify the file: http://docs.astropy.org/en/latest/io/fits/usage/verification.html#verification-using-the-fits-checksum-keyword-convention
(example after adding prints in _ValidHDU._verify_checksum_datasum).
In [1]: %astropy
Numpy 1.15.4
Astropy 3.2.dev23320
In [2]: hdu = fits.ImageHDU(data=np.arange(10))
In [3]: hdu.writeto('test.fits', checksum=True, overwrite=True)
In [4]: hdul = fits.open('test.fits', checksum=True)
verify checksum <astropy.io.fits.hdu.image.PrimaryHDU object at 0x7fedcefbf240>
verify datasum <astropy.io.fits.hdu.image.PrimaryHDU object at 0x7fedcefbf240>
In [5]: len(hdul)
verify checksum <astropy.io.fits.hdu.image.ImageHDU object at 0x7fedcefc6320>
verify datasum <astropy.io.fits.hdu.image.ImageHDU object at 0x7fedcefc6320>
Out[5]: 2
The text was updated successfully, but these errors were encountered:
Since the addition of lazy loading, checksum are verified only for the primary HDU when opening the file, and the other HDUs are verified only when (and if) there are loaded. So if an invalid HDU is not explicitly loaded, it will not be verified.
I think this is wrong, and specifying
checksum=True
infits.open
should load all HDUs to verify them. The documentation also states that opening is enough to verify the file: http://docs.astropy.org/en/latest/io/fits/usage/verification.html#verification-using-the-fits-checksum-keyword-convention(example after adding prints in
_ValidHDU._verify_checksum_datasum
).The text was updated successfully, but these errors were encountered: