-
Notifications
You must be signed in to change notification settings - Fork 74
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 Spatial Collapsed Spectrum selection to Line Analysis #1583
Conversation
self.spatial_subset = SubsetSelect(self, | ||
'spatial_subset_items', | ||
'collapsed_spectrum_selected', | ||
default_text='Entire Cube Spectrum', | ||
allowed_type='spatial') |
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'd advocate for using the same traitlet names and default text as in model fitting so there is a consistent UX and API for the user between the two. If there are subtle differences that we want to capture in the UI, then the hint might be the easiest place to make that distinction. (Or we can always change model fitting to match if there is a good reason to make changes).
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'd still like to see this addressed/discussed before approving/merging!
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 was going to address this in my "review phase" now that the CI is passing. I think I've mellowed on my original intent, so I'm happy to switch it back! Let me do that first and I'll rerequest review
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 am not familiar with model fitting, so maybe @rosteen or @javerbukh would have opinions.
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.
Effectively the distinction I tried to make is between selecting the spatial subset itself, or the spectrum generated from the spatial subset. Effectively, it looks identical on the front end, but it's slightly different here in the backend
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.
@kecnry I've reverted those changes so they should match; let me know if it's sufficient, or if I missed something!
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 do see your point, but just really want to strive for self-consistency across plugins, especially with attribute names and options since we're looking to expose these directly in #1401. This still differs from model fittings spatial dropdown (which is the same use-case: acting on the spectrum corresponding to the referenced spatial subset), in that model fitting has "Entire Cube" and this has "Entire Cube Spectrum". I definitely think they should be the same, and personally would vote for "Entire Cube" and add any clarification to the user in the dropdown hint and/or docs. But if others prefer being more verbose, then let's also make the change to model fitting.
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.
Ahh, I misinterpreted your concern to be about the actual traitlets, not realizing you were also concerned about the labeling. I can understand your concern; I'll revert the labeling as well and we can defer this discussion to another day
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.
Ok, I changed the default text/labeling as well. I reworked the hint
to try and make it explicit. How does that look @kecnry ?
e9e3328
to
6566513
Compare
jdaviz/configs/specviz/plugins/line_analysis/tests/test_line_analysis.py
Show resolved
Hide resolved
6566513
to
0ecf6b0
Compare
jdaviz/configs/specviz/plugins/line_analysis/tests/test_line_analysis.py
Outdated
Show resolved
Hide resolved
I rewrote your test and it passed on CI, so hopefully it will continue to pass and that wasn't a transient happy accident. 🤞 See duytnguyendtn#1 The original test case is perhaps too unrealistic to the point of triggering some edge case behavior where sometimes the calculation would give you a number and sometimes a NaN. I also found that even with the new test case, I need to reduce the width to avoid NaN. |
TST: Use a slightly more realistic test case
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.
Minor change log typo aside, it did work as advertised while I was investigating the CI failure, so approving. Thanks!
Co-authored-by: P. L. Lim <[email protected]>
Codecov ReportBase: 86.35% // Head: 86.37% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1583 +/- ##
==========================================
+ Coverage 86.35% 86.37% +0.02%
==========================================
Files 94 94
Lines 9410 9417 +7
==========================================
+ Hits 8126 8134 +8
+ Misses 1284 1283 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
if self.config == 'cubeviz' and self.spatial_subset_selected != 'Entire Cube Spectrum': | ||
# then we're acting on the auto-collapsed data in the spectrum-viewer | ||
# of a spatial subset. In the future, we may want to expose on-the-fly | ||
# collapse options... but right now these will follow the settings of the | ||
# spectrum-viewer itself | ||
full_spectrum = self.app.get_data_from_viewer('spectrum-viewer', | ||
self.spatial_subset_selected) | ||
else: | ||
full_spectrum = self.dataset.selected_obj |
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.
this is currently duplicated logic from model fitting (I believe). That's probably fine for now, but if we start extending this pattern to more plugins, we should consider something like self.dataset.get_spatial_spectrum(self.spatial_subset_selected)
to move the logic to a shared location.
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.
Seems to work well, thanks! (womp, womp, same CI failure that I thought was fixed by @pllim - as long as fixing that doesn't affect the implementation, I think this is ready to merge once CI passes).
Oops something broke, one sec |
Ok that should fix it (at least it's passing locally). Let's merge once these tests pass |
Description
Previously, it was not possible to perform line analysis on the spectrum generated by Cubeviz' autocollapse for spatial subsets. This PR adds that feature.
BIG THANKS to @pllim for fixing the mysterious test failure!
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
?