question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gammapy.irf is a horrible mess

See original GitHub issue

Problem

gammapy.irf contains many classes to represent IRF tables with different axis. At the moment it is very difficult to use (even for me, who wrote many of these classes). I think the problem is that the class naming is not coherent at all. Sometimes classes are called SomeIRF2D and sometime EnergyDependentSomeIRF and sometimes it’s not clear at all what a certain class represent. In some cases, classes representing a certain type of IRFs are missing completely (the functionality might be hidden in other classes, but should be exposed for easier, clearer code structure, I think). If we plan to use gammapy as a tool for CTA simulation, prototyping etc. good IRF classes are a must.

Status quo

Axis names are defined as follows (should be in agreement with https://gamma-astro-data-formats.readthedocs.io/en/latest/)

  • theta : Offset from pointing position, field of view offset
  • energy : True energy
  • ereco : Reconstruced energy
  • offset : Offset from observation position (for PSF)
  • migra : Energy migration ( e_true / e_reco)

At the moment the situation is the following

Energy Dispersion

Axes Class name Current axis names Proposed Class Name
theta energy migra EnergyDispersion2D etrue offset migra EnergyMigration3D
migra Not implemented EnergyMigration1D
energy ereco EnergyDispsersion e_true e_reco EnergyDispersion2D
ereco Not implemented EnergyDispersion1D

Effective Area

Axes Class name Current axis names Proposed Class Name
theta energy EffectiveAreaTable2D energy offset EffectiveArea2D
energy EffectiveAreaTable energy EffectiveArea1D

PSF

I list parameters as separate axis for parametrized version of the PSF

Axes Class name Current axis names Proposed Class Name
energy theta sigmas, norms EnergyDependentMultiGaussPSF energy theta MultiGaussPSF2D
energy offset EnergyDependentTablePSF energy offset TablePSF2D
energy offset theta PDF3D energy offset rad TablePSF3D
energy theta gamma, sigma PSFKing energy offset KingPSF2D
offset TablePSF offset TablePSF1D

Futhermore there are GaussPSF, HESSMultiGaussPSF, PositionDependentMultiGaussPSF, SherpaMultiGaussPSF . I am not always sure what their purpose is, should be made clear in the docstrings. In same cases gammapy might not be the right place for them.

Plan

I propose the following (to be discussed)

  • Find good naming scheme (see proposals in the table above)
  • Add overview table to the docs explaining which IRFS class has which axis and so on.

cc @cdeil @adonath @JouvinLea @registerrier @alziegler @dltiziani

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
adonathcommented, Jan 15, 2021

After #3185, cleaning this up a bit more is in scope for v1.0 again. I’ll make a proposal with a naming scheme here soon.

0reactions
adonathcommented, Nov 18, 2021

Form the activity here in the issue it seems we will stick with the current names for v1.0. This is acceptable, as the current system works and code is shared under the hood with ND base classes. The recommendation here would be to relabel to v1.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developer HOWTO — gammapy v0.6
Class attributes (data members) and properties are currently a bit of a mess, see SkyCube as an example. Attributes are listed in an...
Read more >
Karl Kosack CEA Paris-Saclay / CTA Observatory ...
•Existence of AstroPy and early GammaPy ... with python: (numeric / numarray mess, slowness, etc) ... IRFs. Stage 6. Catalog. Generation. Diffuse Mode....
Read more >
PhD thesis - IMPRS HD
bad weather (rain or high cloud coverage) and technical issues. ... IRF application and γ-hadron separation As the numerically dominant hadron-induced.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found