-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
BUG: Fix get_model_parameters for Gaussian1D #976
Conversation
Codecov Report
@@ Coverage Diff @@
## main #976 +/- ##
==========================================
+ Coverage 70.06% 70.10% +0.04%
==========================================
Files 71 71
Lines 5121 5118 -3
==========================================
Hits 3588 3588
+ Misses 1533 1530 -3
Continue to review full report at Codecov.
|
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.
Looks like unit tests that would cause the old code to crash but the new one to pass, would be useful here. Any idea on what was the particular case that caused the Gaussian fit to crash?
Since there is zero test right now, trying to write up a sensible test would take like 5-10x as long as writing the fix... 👀 |
The case is explained in #975 |
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.
Confirmed that it was broken, and now it's not! Thanks 👍
I think there are tickets open to add unit testing for some of the plugins where it's missing already, so I support that being a separate effort from this fix. |
Was this caused by a change in astropy (do we need to worry about older versions of astropy still relying on the old if-statement)? |
|
Still, doesn't hurt to do a test with this using astropy 4.3.x Line 21 in e338e9b
|
Seems to work with >>> specviz.get_model_parameters()
{'Model':
{'amplitude_0': <Quantity 29.58504463 1e-17 erg / (Angstrom cm2 s)>,
'mean_0': <Quantity 6858.37344117 Angstrom>,
'stddev_0': <Quantity 63.64975782 Angstrom>,
'amplitude_1': <Quantity 54.63609656 1e-17 erg / (Angstrom cm2 s)>}} >>> cubeviz.get_model_parameters()
{'Model':
{'slope': <Quantity 1364993.81048269 1e-17 erg / (Angstrom cm2 m s)>,
'intercept': <Quantity 0.74306448 1e-17 erg / (Angstrom cm2 s)>},
'Model_3d': {
'slope': <Quantity [[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318],
[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318],
[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318],
...,
[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318],
[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318],
[-1.831916e-318, -1.831916e-318, -1.831916e-318, ...,
-1.831916e-318, -1.831916e-318, -1.831916e-318]] 1e-17 erg / (Angstrom cm2 m s)>,
'intercept': <Quantity [[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324],
[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324],
[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324],
...,
[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324],
[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324],
[5.e-324, 5.e-324, 5.e-324, ..., 5.e-324, 5.e-324, 5.e-324]] 1e-17 erg / (Angstrom cm2 s)>}} |
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.
Much cleaner and since it seems to work on our required minimum version of astropy, I think this is good to merge!
Description
This pull request is to remove special unit handling for Gaussian model because it breaks
viz.get_model_parameters
. Not sure why they were added but maybe it was needed at some point but it is no longer the case.I cannot find any unit tests for the Model Fitting plugin, that this method is affected by. This method is also not in any other existing tests. So maybe adding a test for this fix is out of scope... 😬
Fixes #975
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.CHANGES.rst
?