[AstroPy] pyfits: reading fits data problem

Perry Greenfield perry at stsci.edu
Tue May 26 11:32:09 EDT 2009


On May 26, 2009, at 9:26 AM, Guillaume Blanc wrote:

> Thanks a lot for your quick replies...
> Actually my fits file was effectively not "standard". If I set the
> DATE keyword in the standard form (using the sethead script from
> wcstools), it works, even if the fits verifier says: "*** Error:
> File has extra byte(s) after last HDU at byte 63360." ??
>
> But perhaps the pyfits library is too tightly linked to the
> standard... And the error sent was quite enigmatic.
>
> Cheers,
> Guillaume

Apparently the fundamental problem is that the original file contains  
newlines in the header. PyFITS is not finding the end of header as a  
result and everything is thrown off regarding file size. It's possible  
that in fixing the DATE value you fixed most of these newline issues  
inadvertently (thus it looked like fixing date fixed the problem).  
While we could spend time trying to have PyFITS handle all sorts of  
nonstandard header characters, this is one we decided not to handle  
explicitly. Whatever software is generating these newline-laden  
headers really ought to be fixed instead.

Thanks, Perry




More information about the AstroPy mailing list