[AstroPy] Fixing broken FITS headers

Derek Homeier derek at astro.physik.uni-goettingen.de
Thu Aug 18 19:44:44 EDT 2016


On 19 Aug 2016, at 12:53 am, Russell Owen <rowen at uw.edu> wrote:
> 
> I will push back gently on this. Where practical it is best to be liberal in what you read, though of course the code should always write correct files.
> 
> — Russell
> 
>> On Aug 18, 2016, at 3:46 PM, John K. Parejko <parejkoj at uw.edu> wrote:
>> 
>> We should not expect our FITS readers to behave correctly when given invalid files. The fact that those files were handled ok in astropy under python2.7 was due entirely to luck. Yes, there are many badly formatted FITS files out in the wild, but that's not the fault of astropy.io.fits.
>> 
And that could be bad luck as well, as the issue I referenced earlier shows:
https://github.com/astropy/astropy/issues/5093

This was not in fact a problem of non-ASCII characters in the header as such,
but of an illegal (2080 bytes) header length, resulting in the first 800 data bytes
being read in as padding. Not surprisingly, those contain a fair share of non-ASCII
bytes, but in Python2.7 they would be silently accepted, resulting in a corrupt data
HDU read in.

My 2d,
					Derek





More information about the AstroPy mailing list