Plotting module
Closed this issue · 9 comments
After discussing with @vuillaut, this is a proposal for a simple plotting module (aka pyirf.plot
or pyirf.vizualization
).
Context:
This module would provide a simple and fast visualization suite to look into pyirf products (even in-between, for testing and benchmarking) without medium/high knowledge of any science tools.
There is some overlap between this and ctaplot.
The latter could focus on sub-DL3 products, but it can still be useful to see e.g. the effective area before cut optimization (even though this can also be done by pyirf since it applies the cuts on DL2 data after reading it).
What we have:
- in
pyirf.scripts.lst_performance
there are at least 1 function per IRF + a function to plot sensitivity using ctaplot API components - in PR #12 we have a notebook to plot all IRFs + sensitivity curve (artisanal plotting code made for fast testing)
One notebook should be sufficient, each plot saved separately or together, with a set of metadata.
Plotting could be done entirely by calling the specific gammapy API (a few methods).
What is missing:
- a DL3 reader
- a configurator for plots (could be e.g. a dedicated config file or - better - part of the one already existing in PR #12 ) which then can be read via papermill by the notebook
- the notebook could be interactive (binder, bokeh, ...)
- reference data like requirements (stored somewhere like for ctapipe+ctapipe-extra and called by the notebook)
- a function that plots a poster with IRFs and sensitivity curve EventDisplay-style (perhaps format A5, conference-ready)
Sounds like a very good plan, I am only wondering about the gammapy
dependency.
For information, although that might be more useful for ctaplot
?, we have currently two pieces of code related to plotting IRFs:
Sounds like a very good plan, I am only wondering about the
gammapy
dependency.
Yes, this is more or less the same discussion as for ctapipe.
Personally, I am not a fan of re-inventing the wheel and from one side I would prefer if pyirf performed its internal operations (core utilities - configuration - plotting) in a simple independent way from ctapipe and science tools...
Though in the case of plotting the situation is probably more elastic, because
- the scope of pyirf is not of plotting its output (this can be done anyway from the science tools)
- given the (eventually) fixed output format (so by when pyirf has done its job) it's not really important what tool we use to plot because any of them have to support it (gammapy is just the simplest one we can use from here, I guess).
At the same time, I would like something simple and fast for benchmarking, testing or even for a pipeline user that maybe doesn't care to use a full science-tool just for producing 5 plots.
In this module, you might want to delegate as much plotting as you can to gammapy, just to minimize code. GammaPy already has some nice plots for things like IRFs.
Plot wishlist
General
- IRF overview plot (like Gernot shows, everything in one picture)
- Detailed plot for each IRF and the sensitivity
- Plots of the optimized cuts
- Event efficiencies
Some diagnostic plotting code was present inside pyirf.cut_optimization.CutsDiagnostic
(e.g. commit 0bf3f40
)
Such plots are a single efficiency plot and one plot per energy bin like the following,
Just for reference, here is what Gernot's canvas look like:
sensitivity, sensitivity ratio, angular resolution, effective area, background rate, energy resolution
again, not sure if pyIRF shall do that, or if it shall be delegated to e.g. ctaplot, but it's a must have, and when we have it we can think about how to do better!
Do we still want to do this, given ctaplot exists and anyway other pipeline-related projects like magic-cta-pipe do the plotting themselves?
Right now, I would go for ctaplot and not add maintain plotting code here.
agreed
In fact this has already been implemented in the benchmarking suite.