[AstroPy] Re: HIERARCH

Joe Harrington jh at oobleck.astro.cornell.edu
Thu Mar 31 09:45:58 EST 2005


>I'm not so sure. Users can mistakenly write (through typos or use of 
>variables) keywords that are longer than 8 characters without realizing 
>they doing so. In such cases it is probably a good thing to raise an 
>error.

Perry, we're in agreement.  I don't want pyfits to accept STARTTIME as
a keyword.  But, I want it to accept HIERARCH ESO STARTTIME into a
header already containing HIERARCH keywords, without complaint.  I
don't think anyone is going to type "HIERARCH" before anything
accidentally.  As far as I know, the HIERARCH extension is the only
long-keyword extension in wide use, and it is in very wide use.  That
might justify special-casing "HIERARCH".  But there might be a more
general way.

Maybe the way to do this is to have a "strict" flag as a property of
the header (separate from actual header entries like SIMPLE=T), and to
clear it if there is a non-standard extension or a recoverable error
in the file when read.  Aside from HIERARCH, there are many other
cases where large amounts of data are in nearly-conforming files.  For
example, the IRTF produced files for a few years in the late '90s with
a final card that read:

END     =

That case is non-standard, but easily recoverable.  If users wanted,
they could standardize those headers and then reset the strict flag.
HIERARCH headers would clear that flag when read as well.  Adding
keywords conforming to a known "gray" convention like HIERARCH would
error out unless the strict flag were cleared, which it would be for
any header that already contained a HIERARCH keyword.  So, people
reading and writing HIERARCH headers wouldn't be bothered with
manually clearing the strict flag, but adding a HIERARCH keyword to a
non-HIERARCH header would require manually clearing the flag first.

But, far more important is that it accept HIERARCH keywords under some
conditions, whether or not one has to turn it on.

--jh--



More information about the AstroPy mailing list