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

Freeze source parameters in FluxEstimator #4567

Merged
merged 2 commits into from Dec 2, 2023

Conversation

registerrier
Copy link
Contributor

Description

This pull request modifies the behaviour of FluxEstimator freezing all the source of interest parameters to only leave the norm of the ScaleSpectralModel free.
This was discussed in #2877 but we never implemented it. It does not seem meaningful to leave the source spatial parameters free. Can we guarantee that it does not fit a different source?

Because the Fit and the Estimator classes are stateless, it does not seem possible to properly test that the source spatial parameters do not change during the various steps. Could there be a way to test this?

Dear reviewer
This changes the behavior rather strongly, but I can't really see a good reason to leave the non spectral parameters of the source of interest free. Opinions?

@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d4024ac) 75.77% compared to head (9010be3) 75.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4567   +/-   ##
=======================================
  Coverage   75.77%   75.77%           
=======================================
  Files         227      227           
  Lines       33310    33311    +1     
=======================================
+ Hits        25240    25241    +1     
  Misses       8070     8070           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@registerrier registerrier added this to the 1.2 milestone Jun 13, 2023
@AtreyeeS
Copy link
Member

This is the issue reported in #4472
Specially for upper limit computation, this becomes a big problem as the extension continuously keeps changing, so each upper limit corresponds to a different region. And, the fit sometimes goes ends on a different source.

@adonath suggested we leave it to the user to freeze all spatial parameters before running the estimator.
Then we should explain the behaviour and the caveats clearly.

@bkhelifi
Copy link
Member

The suggestion of @adonath is wise, indeed. However, are the non-expert aware of the issue? Is there properly documented?
The other possibility is to add a comment or a note in the doctring...

QRemy
QRemy previously approved these changes Dec 1, 2023
Copy link
Contributor

@QRemy QRemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote to merge this.

@QRemy QRemy self-assigned this Dec 1, 2023
Copy link
Member

@bkhelifi bkhelifi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, this behaviour seems very reasonable and logical. So, I do approuve this PR.

One should however precise this behaviour in the docstring (and maybe in global rst page), and precising also that a global fit is needed as prior

AtreyeeS
AtreyeeS previously approved these changes Dec 2, 2023
Copy link
Member

@AtreyeeS AtreyeeS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no good reason to not merge this, so +1 from my side as well.
But this should be added in the estimator user guide, and the change in behaviour specifically mentioned in the release notes.

registerrier and others added 2 commits December 2, 2023 15:14
Signed-off-by: Régis Terrier <rterrier@apc.in2p3.fr>
Signed-off-by: Quentin Remy <quentin.remy@mpi-hd.mpg.de>
@QRemy QRemy dismissed stale reviews from AtreyeeS and themself via 9010be3 December 2, 2023 14:33
@QRemy
Copy link
Contributor

QRemy commented Dec 2, 2023

Thanks for the feedback @AtreyeeS , @bkhelifi.
I modified the docs as suggested, could you have one last look before merging ?

Copy link
Member

@bkhelifi bkhelifi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @QRemy

Copy link
Member

@AtreyeeS AtreyeeS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @QRemy ! Merging this

@AtreyeeS AtreyeeS merged commit 20f25bf into gammapy:main Dec 2, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants