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
Adjust to_edisp_kernel
input to MapAxis
#5186
base: main
Are you sure you want to change the base?
Conversation
9524fad
to
b38a092
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Astro-Kirsty !
I do not think you need to adapt internet tests to check for the deprecation warning, eg as done in gammapy/datasets/tests/test_map.py
It only needs to be checked when the user passes a quantity instead of a MapAxis
in the to_edisp_kernel
function, and internally within Gammapy we should pass a MapAxis
.
def to_edisp_kernel(self, offset, energy_true=None, energy=None): | ||
@deprecated_renamed_argument( | ||
["energy_true", "energy"], | ||
["energy_axis_true", "energy_axis"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to rename the argument name or keep the name and change the type?
Either of the two should suffice, no?
If a DepricationWarning
is raised about the argument name, then the warning
below is not necessary.
I think we can keep the argument same same, and just allow a MapAxis
on input. Then, we can raise a deprecation warning if a Quantity is passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the argument name to be consistent with others in the code, for example here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion here - you can modify the name and remove the warning about passing the Quantity
.
You will anyways need to adapt all calls to to_edisp_kernel
to take a MapAxis
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay sure thing! Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So deprecated_renamed_argument
will only let the user know that there was a name change, but not that it should now be a MapAxis
Signed-off-by: Astro-Kirsty <AstroKirsty@gmail.com>
Signed-off-by: Astro-Kirsty <AstroKirsty@gmail.com>
9acb1cb
to
36ae743
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5186 +/- ##
=======================================
Coverage 75.27% 75.28%
=======================================
Files 234 234
Lines 35148 35150 +2
=======================================
+ Hits 26458 26461 +3
+ Misses 8690 8689 -1 ☔ View full report in Codecov by Sentry. |
This PR is to resolve #5142.
I left it as a draft as I am not sure if this is the correct procedure to take.
This is two part issue, we want to change the variables to be consistent with the other naming for axis
gammapy/gammapy/irf/edisp/map.py
Line 116 in 86488ec
We also need to change the variable to no longer be a quantity but a
MapAxis
.This was the best way I could think to achieve this.
Note: there are a number of failing tests, but I did not want to fix them all with the deprecation warning until a method was decided upon.
I am open to suggestions.