-
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
Update Cubeviz to work on data with spectral axis last #1174
Conversation
The other motivation for posting this now is to make sure it doesn't conflict too much with #1040 . And it obviously needs rebasing. |
This comment was marked as resolved.
This comment was marked as resolved.
9191040
to
21d8488
Compare
@@ -119,15 +119,24 @@ def _parse_hdu(app, hdulist, file_name=None): | |||
if hdu.data.dtype in (int, np.uint, np.uint32) or \ | |||
any(x in hdu.name.lower() for x in EXT_TYPES['mask']): | |||
app.add_data_to_viewer('mask-viewer', data_label) | |||
viewer = app.get_viewer('mask-viewer') | |||
viewer.state.x_att_world = app.data_collection[data_label].id['Right Ascension'] |
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.
Does this work with data with no WCS? I am trying to think how this would fit into #1040 .
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 think I need a case here to fall back on Pixel Axis 0 [z]
(or whichever is appropriate) for things with no WCS.
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 sure which axis that would be. I have found that specutils only attempt to swapaxes if it detects a WCS, so for anything without WCS, I needed to transpose. If you look at PR 1040, you will see a lot of array.T
happening here and there. 🤪 Do I still need that with this patch?
80a78bb
to
4b2f356
Compare
CI won't pass yet because this needs glue-viz/glue-astronomy#68. The tests pass locally on my machine with that installed. |
Upstream PR is merged, so theoretically, if you pin |
Codecov Report
@@ Coverage Diff @@
## main #1174 +/- ##
==========================================
+ Coverage 77.93% 79.53% +1.60%
==========================================
Files 90 90
Lines 7180 7209 +29
==========================================
+ Hits 5596 5734 +138
+ Misses 1584 1475 -109
Continue to review full report at Codecov.
|
6ec3102
to
6e8250f
Compare
I think this is almost ready for in-depth review. There's one persistent bug that I'm aware of that I haven't fixed yet, where calculating a moment with a viewer selected to auto-plot the results will throw an |
I fixed the above error with a small change to |
We need to pin to glue-astronomy dev with this PR, right? |
Yes, the setup.cfg file here has it pinned. |
@rosteen - did you fix the issue you asked me about above or should I still investigate? |
I did figure out a fix, no need to investigate. |
# Make sure that the x_att is correct on data load | ||
ref_data = self.state.reference_data | ||
if ref_data and ref_data.ndim == 3: | ||
for att_name in ["Right Ascension", "RA"]: |
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 better way to detect world vs pixel? I feel like hardcoding RA might box us in to only certain world coordinate frames.
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.
Digging into Glue and looking at what the other options that might occur here are, it seems like Galactic Longitude/Latitude are probably the only others we might need to worry about (I don't want to mess with supporting solar people and their crazy helioprojective things right now 😆). I don't know if people would want lat or lon on the x-axis, I'll ask the POs.
jdaviz/configs/cubeviz/helper.py
Outdated
viewer = self.app.get_viewer("spectrum-viewer") | ||
ref_data = viewer.state.reference_data | ||
if ref_data and ref_data.ndim == 3: | ||
for att_name in ["Wave", "Wavelength", "Freq", "Frequency"]: |
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.
Do people make cubes in wave number, etc? How do these map to supported CTYPE and how many of those we need to actually support?
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.
Looking at the glue-astronomy translator, it seems like the other likely options are Wavenumber, Velocity and Energy. I'll add those.
…fter initial data load.
I can get more specific about how to reproduce:
Cubeviz still runs but the line analysis plugin hangs. |
Looks like everything works great other than the error I mentioned and the spectrum viewer not automatically reseting limits. If the former originates outside the PR and the latter will work after merge/rebase, I'm ready to approve this. |
I'm investigating the cube fitting, it is a problem with this PR and I should have a fix soon (I hope). This also led me to notice that the fit to the spectrum isn't getting properly plotted in the spectrum viewer either, so I'm trying to figure that out as well. Good catch. |
6fd3e19
to
485a20a
Compare
@javerbukh I think that the last bug in the model fitting is also present on main, could you confirm that I'm not crazy? Basically if you fit the whole cube with a spectral subset selected, the results comes back with all zero values. Very not great, but not due to these changes as far as I can tell. |
What does this give you?
|
|
See #1245 for the followup on the Cubeviz fitting bug. |
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.
Everything seems to work now, and it'll definitely be good to get this change in and behind us!
When I press |
This is also present on Edit: See #1246 |
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.
Sounds good, thanks for opening the ticket!
Description
This implements compatibility with glue-viz/glue-astronomy#68, which stops reordering Cube axes and leaves things the way they are in the
specutils.Spectrum1D
object. Opening as draft since this is very experimental and still needs work - I've fixed the data loading and slice plugin, but I'm sure a couple other things were broken by this. Mainly I wanted other people to see it if they're curious.TODO
jdaviz/tox.ini
Line 57 in a9d2dfa
jdaviz/setup.cfg
Line 36 in a9d2dfa
glue-astronomy>=0.4
.xref #1190
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
?