-
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
Fix unit handling in continuum and moment calculations #3216
Conversation
full_spectrum = self.app._jdaviz_helper.get_data(self.dataset.selected) | ||
full_spectrum = self.app._jdaviz_helper.get_data(self.dataset.selected, | ||
use_display_units=True) |
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 feel like @cshanahan1 had just removed this. Was there a reason for that or did it just not seem to affect that use-case (see https://github.com/spacetelescope/jdaviz/pull/3211/files#r1787615549)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3216 +/- ##
=======================================
Coverage 88.56% 88.56%
=======================================
Files 125 125
Lines 18751 18755 +4
=======================================
+ Hits 16606 16610 +4
Misses 2145 2145 ☔ View full report in Codecov by Sentry. |
In testing I am still seeing the traceback occur for moment zero (and it is occurring if you chose any spectral unit we allow). |
Can you give some more detail about your workflow? I see everything working fine on my end: Screen.Recording.2024-10-15.at.9.53.42.AM.mov |
I went through the workflow you showed in the video, and in the video below, and I double checked in a second conda environment and in both I was seeing the traceback: Screen.Recording.2024-10-15.at.10.09.17.AM.mov |
Oh, that's not the same workflow as I used, you don't have a spectral region or continuum selected. I can't reproduce the error you're seeing though even without a region or continuum, although I do see an |
Ok, I just tried in a fresh environment and still only saw the error with the subset + no continuum combo, so I'll work on fixing that for now. |
Turns out the error I was seeing is due to a bug in specutils, see astropy/specutils#1187. We'll need to update the specutils pin after I release 1.18.0, I can do that here before we merge this. |
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.
The tracebacks I was seeing came from my end, all resolved and working now! With the workflow you provided I tried many combinations with the example notebook and with a flux cube. The main notes I had I think are all outside of scope and are being addressed in follow ups and deal with the spectral density or pix2 handling.
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 tested this with a cube in Jy / pix2 as well as Jy / sr and both work, including the continuum preview. My only take it or leave it suggestion would be to include changing spectral units and slice value in tests to make sure that those changes are reflected in the calculation.
Thanks for the reviews, I just bumped the specutils pin to the new release. I'll merge once tests pass. |
Fixes calculating moment 0 when display unit is in Hz, and more generally uses display unit more consistently in all continuum calculations.