Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to transform from energy dispersion to energy migration #48

Closed
maxnoe opened this issue Sep 28, 2020 · 16 comments
Closed

Add function to transform from energy dispersion to energy migration #48

maxnoe opened this issue Sep 28, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@maxnoe
Copy link
Member

maxnoe commented Sep 28, 2020

Energy dispersion is a better format for storage, as it is less sparse, but for actual computations, one needs energy migration.

We should have a function that transforms the energy dispersion matrix (Bins true energy, reco_energy / true_energy) to migration matrix (bins true_energy, reco_energy).

This is needed to estimate sensitivity from IRFs

@maxnoe maxnoe added enhancement New feature or request good first issue Good for newcomers labels Sep 28, 2020
@LukasNickel
Copy link
Member

So the difference is just in the value of the migration bins? The documentation uses these two terms interchangeably btw:
https://cta-observatory.github.io/pyirf/irf/index.html

@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

Yes, we should make a clear distinction.

The difference is the second axis of the IRF, yes. One is the relative change one is absolute reconstructed energy.

@HealthyPear
Copy link
Member

perhaps the associated modification to the docs can be done together with the addition of this function

@LukasNickel
Copy link
Member

Is there an official document, that we could link for that?

@LukasNickel LukasNickel self-assigned this Sep 28, 2020
@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

@vuillaut I don't think this has anything to do with full enclosure irfs.
It's not needed for the computation of the IRFs and should be the same procedure for point-like as for full-enclosure IRFs.

@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

Is there an official document, that we could link for that?

I don't think so. But there should be code in gammapy that does this transformation.

Maybe @adonath can give you a pointer

@HealthyPear
Copy link
Member

This ambiguity is also found in the OGADF website: energy dispersion is defined as the PDF of energy migration

@vuillaut
Copy link
Member

@vuillaut I don't think this has anything to do with full enclosure irfs.
It's not needed for the computation of the IRFs and should be the same procedure for point-like as for full-enclosure IRFs.

Don't we want to compute the sensitivity from IRFs at the end?
Ok not directly related.

@HealthyPear
Copy link
Member

HealthyPear commented Sep 28, 2020

Don't we want to compute the sensitivity from IRFs at the end?

Indeed, but I believe this is only important for cut optimizations which are not best-sensitivity (in that case the sensitivity depends on the specific optimized IRF no?)

Since we are now optimizing for best-point-source sensitivity, the sensitivity from the IRFs should coincide with that form the optimized cuts.

@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

Don't we want to compute the sensitivity from IRFs at the end?
Ok not directly related.

Yes, it's a TODO for the sensitivity calculation from IRFs

@LukasNickel
Copy link
Member

Energy dispersion is a better format for storage, as it is less sparse

This is because the transformation introduces additional bins outside of the "dispersion range" for a given true energy, right?
So there are a lot of new bin combinations, that just remain empty.

@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

Yes, basically you never expect an event to go from 100 GeV to 100 TeV. But if you have a migration matrix with both ranges from 10 GeV to 100 TeV you will have to store also these bins.

@adonath
Copy link

adonath commented Sep 28, 2020

In Gammapy we use the term "energy dispersion" (or EDisp...) as the general term for the energy resolution. The actual implementation is either handled with the migration PDF (e.g. for event simulation), or an integrated matrix for the forward folding (that we either call RMF or EDispKernel matrix). We have a docs page to explain the energy dispersion, but we still have to fill it (https://docs.gammapy.org/0.17/irf/edisp.html)...

@maxnoe In Gammapy we have code to integrate the energy migration PDF in a given reco energy range to compute the RMF matrix. This code is e.g. in

I think this is what you meant?

@adonath
Copy link

adonath commented Sep 28, 2020

But I fully agree we should clarify and agree on the terminology...I'm adding @registerrier to the discussion as well.

@maxnoe
Copy link
Member Author

maxnoe commented Sep 28, 2020

Yes exactly, thanks @adonath

As the needed shape is known before hand, you could create the matrix using np.zeros and then assign computed columns instead of the list appending / stacking approach.

@maxnoe
Copy link
Member Author

maxnoe commented Dec 18, 2024

Done in #273

@maxnoe maxnoe closed this as completed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants