gammapy.irf is a horrible mess
See original GitHub issueProblem
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 offsetenergy: True energyereco: Reconstruced energyoffset: 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:
- Created 7 years ago
- Comments:9 (8 by maintainers)

Top Related StackOverflow Question
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.
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.