gammapy / gammapy

A Python package for gamma-ray astronomy
https://gammapy.org
BSD 3-Clause "New" or "Revised" License
223 stars 194 forks source link

Add theta2 plots in gammapy? #1450

Closed cosimoNigro closed 6 years ago

cosimoNigro commented 6 years ago

Hi,

In MAGIC to have a quick look of the excesses in an observation and to assess their significance we use theta2 plots. These are basically histograms of the ON and OFF counts in theta2 (angular distance from the centre of the on/off regions) theta2flare We count (integrate) the ON and OFF counts within a certain theta2 cut (i.e. the on region size) to get the excess and then compute their significance. I have to produce theta2 plots for a MARS / gammapy comparison analysis I am doing, if you think they could be useful for gammapy I am willing to add them to gammapy. For point like sources it is a straightforward way of estimating the significance without using a skymap, or it can also be the first step to see if a source has an extension. It can also reveal features in the background (like non-homogenities in the off regions).

Let me know what do you think.

Thank you

cdeil commented 6 years ago

Short answer: I'm not sure if / what kind of code we should add.

What we have already
What to add?

@cosimoNigro - What exactly would you propose to add? I.e. which functions / methods / classes? Are they separate from the existing spectral or other analysis code, or integrated somehow? Is the background estimate pixel-based or event-based?

Clearly we should provide something that makes it relatively straightforward to make this plot, it's commonly used, we have it in HESS as well.

But IMO we should avoid adding a lot of code for this, like we did with the ObservationStats, ObservationSummary, ObservationTableSummary and the too many pixel-based *_profile functions we have in gammapy.image.

Maybe start with a Jupyter notebook in gammapy_extra/notebooks showing an example how to compute the theta2 histograms (especially the background estimation) and how to make the plot, and then we discuss if / what parts to move into the Gammapy package?

cdeil commented 6 years ago

Discussed with @cosimoNigro in the Gammapy call just now. Decided to close this feature request for now. We could still add something in the future, if someone is willing to send a pull request and it's not too much or to complex code. Plotting should always be separate from documentation.

@cosimoNigro - If you have working code for this, you could add add it as a docs example either in Gammapy, or link to it from Gammapy for now. That way, we show how to do it, but don't offer code / promise to maintain to users.

Bultako commented 6 years ago

FYI In case it helps, here's a notebook on how to do theta2 plots with ctapipe

https://github.com/cta-observatory/ctapipe/blob/master/examples/notebooks/Theta%20square%20plot.ipynb