gamma-astro-data-formats icon indicating copy to clipboard operation
gamma-astro-data-formats copied to clipboard

IRF axis order again

Open cdeil opened this issue 6 years ago • 5 comments

Friends, I fear we have to discuss IRF axis order again and work on it some more.

This was discussed in #28 and I thought we had fixed / concluded the discussion, basically agreeing to put a "recommended axis order" in the spec (see e.g. current EDISP spec), but also agreeing that we should use the CREF key from the OGIP multi-dimensional dataset FITS recommendation (see here and mention of that in our spec here). The advantage of using CREF is that it's more flexible, someone could change it e.g. for performance reasons, and when adding new IRFs with new axes there's a general scheme to declare in the file, not just in the spec, how to process the IRF.

Currently I see this status:

  • Fermi-LAT and older OGIP data have CREF header keys. @woodmd - do you rely on it in the Fermi ST, i.e. is it required in the Fermi-LAT IRFs?
  • The IRF example files in this spec repo don't. I'll make a pull request to add this shortly.
  • The CTA FITS IRFs (prod 3, 1DC) don't have CREF (cc @jknodlseder @gernotmaier)
  • The HESS FITS IRFs currently don't have CREF (cc @lmohrmann )
  • The MAGIC FITS IRFs currently don't have CREF (cc @TarekHC )
  • Gammapy doesn't support CREF (cc @thomasarmstrong)
  • For Gammalib I don't know. @jknodlseder - does it read and use CREF if present? I think I asked this before and you said "yes"?

What I did was to check AEFF files. They all have this to specify the IRF array shape:

TDIM5   = '(10, 5)'

but they are lacking this to specify the IRF axis order (except for Fermi-LAT and older OGIP IRFs):

 CREF5   = '(ENERG_LO:ENERG_HI,THETA_LO:THETA_HI)'

That example was what should be there for 10 energy bins and 5 theta bins, and following the recommended axis order of energy, offset for AEFF as given here.

Do you agree CREF is useful? If yes, could you please update your IRF FITS writers and readers?

I'm not sure what to do about the spec. It depends on what people say here. My suggestion would be to add a note that CREF is required from now on for writers, but we keep the recommended axis order in the spec and a suggestion that readers look for CREF first, and if it's missing fall back to the hard-coded recommended order for the current IRFs we have. This means everything keeps working, but we get (in my opinion) better files from now on.

cdeil avatar Jan 18 '18 10:01 cdeil