[AstroPy] DATAMD5 calculation
astropy at liska.ath.cx
Wed May 25 11:56:10 EDT 2011
Am 25.05.2011 16:14, schrieb Erik Bray:
> I took a look at the fitsmd5 utility, and as you said it's the MD5 sum
> of all the data sections. Where PyFITS is concerned, _datLoc is just
> the offset within the file where that HDU's data section begins, and
> _datSpan is the length of the data section. Since FITS files are read
> in 2880 byte blocks, there can be some padding at the end of the data,
> which is why it may not be exactly the same as hdu.data.nbytes.
> But it looks like fitsmd5 includes that padding in the sum. The padding
> is just null bytes, so you can still add that yourself. For example:
> FITS_BLOCK_SIZE = 2880
> pad = '\0' * (FITS_BLOCK_SIZE - hdu.data.nbytes % FITS_BLOCK_SIZE)
> And do that for each HDU. I think that would do it.
That works. Thank you very much for your help.
More information about the AstroPy