open-gamma-ray-astro / gamma-astro-data-formats

Data formats for gamma-ray astronomy
https://gamma-astro-data-formats.readthedocs.io
Creative Commons Attribution 4.0 International
29 stars 27 forks source link

The HDU_CLASS header keyword is too long #105

Closed kbruegge closed 6 years ago

kbruegge commented 6 years ago

It contains 9 characters if I'm not mistaken. As far as I know header keywords are only allowed to be 8 characters long. I know astropy can work around this but but its not conforming to the FITS standard I think.

cdeil commented 6 years ago

@mackaiver - the header keyword is HDUCLASS: https://github.com/open-gamma-ray-astro/gamma-astro-data-formats/search?utf8=%E2%9C%93&q=HDUCLASS&type=

The only place where we have HDU_CLASS is in the HDU index table: https://github.com/open-gamma-ray-astro/gamma-astro-data-formats/blob/16d58334db520effaafed492d47a86dacd92fb26/source/data_storage/hdu_index/index.rst That's a bit unfortunate that they aren't consistent, but there it's as a column name and those are OK to be longer than 8 characters.

So given that we won't use that prototype HDU index format forever, I would suggest to leave everything as-is.

(The alternative is to change the spec to HDUCLASS, and also to change Gammapy to support both HDUCLASS and HDU_CLASS to remain consistent with existing tables.)

@mackaiver - OK to leave as-is and close this issue? Or did I misunderstand / misread something and there actually is a HDU_CLASS in a header somewhere in the spec?

kbruegge commented 6 years ago

I found it here: http://gamma-astro-data-formats.readthedocs.io/en/latest/irfs/point_like/index.html

Any point-like IRF component should contain the header keyword:

    HDU_CLAS3 = POINT-LIKE
cdeil commented 6 years ago

Ah, I see, there's these cases of *HDU_CLAS*:

$ ack HDU_CLAS
source/data_storage/hdu_index/index.rst
14:(``HDU_TYPE`` and / or ``HDU_CLASS``), the HDU can be located via the
33:``HDU_CLASS``   HDU class (see below)                             string    yes
44:HDU_TYPE and HDU_CLASS
47:The ``HDU_TYPE`` and ``HDU_CLASS`` can be used to select the HDU of interest.
50:whereas ``HDU_CLASS`` corresponds to a specific PSF format.
51:Declaring ``HDU_CLASS`` here means that tools loading these files don't have
65:Valid ``HDU_CLASS`` values:
78:or the ``HDU_CLASS`` names mentioned above. This is not a requirement, usually

source/irfs/full_enclosure/index.rst
14:* ``HDU_CLAS3 = FULL-ENCLOSURE``

source/irfs/point_like/index.rst
16:* ``HDU_CLAS3 = POINT-LIKE``
36:is required to store these values. Note any DL3 file with a point-like IRF (with ``HDU_CLAS3`` = POINT-LIKE) that 

@TarekHC - This is a typo, no? The HDU_CLAS3 header keys should be changed to HDUCLAS3?

cdeil commented 6 years ago

Fixed in 894775c .