-
Notifications
You must be signed in to change notification settings - Fork 79
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
spectral-extraction: improved initial parameter estimation #1560
Conversation
3664e4e
to
bc3eb9a
Compare
Codecov Report
@@ Coverage Diff @@
## main #1560 +/- ##
==========================================
- Coverage 85.64% 85.61% -0.03%
==========================================
Files 94 94
Lines 9216 9228 +12
==========================================
+ Hits 7893 7901 +8
- Misses 1323 1327 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
c25e98d
to
7b0d6f9
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.
Looks good to me!
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.
Is there a follow-up issue to make Specviz2D parser more flexible and then add the edge case you couldn't add before in this PR?
@@ -237,7 +252,7 @@ def marks(self): | |||
|
|||
viewer2d = self.app.get_viewer('spectrum-2d-viewer') | |||
viewer1d = self.app.get_viewer('spectrum-viewer') | |||
if not viewer2d.state.reference_data or not viewer1d.state.reference_data: | |||
if not viewer2d.state.reference_data: |
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.
What does the removal of the second condition 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.
previously this avoided tracebacks before the original 1d spectrum was extracted. Now this will force that error to occur, which is now caught by the try/except and exposed in the snackbar.
|
||
pext = specviz2d_helper.app.get_tray_item_from_name('spectral-extraction') | ||
assert pext.bg_type_selected == 'OneSided' | ||
assert pext.bg_separation < 0 |
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.
What is < 0
testing? You sure you don't want to be more explicit with numpy.testing.assert_allclose()
?
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.
It's really just testing that the logic detected that the extraction window was so close to the top of the image, that the background region needed to be below the extraction region. I was intentionally non-specific in the test, because we'll very likely improve the separation/width default logic in the future which would change the exact value, but as long as the window-detection logic doesn't change significantly to avoid the edge entirely, that should still always return a negative separation.
Yes there is, I'll add a note in there to also extend the test cases 🐱 |
a26a8d6
to
1aabcf2
Compare
* spectral extraction plugin has not been in a release
* to handle cases where extraction or background regions otherwise would default to outside of the image
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
1aabcf2
to
ff60cd5
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.
LGTM. Thanks!
Description
This pull request improves the automatic initial input parameter determination for input to spectral extraction, particularly for cases where the previous defaults would result in a window outside the range of the image which would throw an error from specreduce. This also prevents other cases like this from throwing a traceback by instead raising an error snackbar message on load and pointing to the plugin for manual extraction.
Re failing coverage checks: I did add test coverage for the near-edge example to ensure it forces a one-sided background, but since the parser only accepts files, its difficult to add coverage for the "brightest pixel on edge" logic and the complete try/except snackbar.
TODO:
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
?