-
Notifications
You must be signed in to change notification settings - Fork 76
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
BUG: Fix parsing of MANGA cube #3115
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3115 +/- ##
==========================================
- Coverage 88.91% 88.89% -0.02%
==========================================
Files 111 111
Lines 17365 17372 +7
==========================================
+ Hits 15440 15443 +3
- Misses 1925 1929 +4 ☔ View full report in Codecov by Sentry. |
If we cannot find a safe assumption here, the correct thing to do is indeed throwing exception because the given data does not have BUNIT defined in its IVAR extension. The data provider should have clearly defined a BUNIT if the data has physical unit. |
Cami said to not load the uncert cube at all in this situation. I will push new commit. |
I think it's a fine assumption for MaNGA, but not sure about in general. You can have a look at the MaNGA docs for cubes at https://www.sdss4.org/dr17/manga/manga-data/data-model/#3-DReductionPipelineOutput and https://data.sdss.org/datamodel/files/MANGA_SPECTRO_REDUX/DRPVER/PLATE4/stack/manga-CUBE.html for more info on the structure. We can't change the MaNGA data now, and I think it's too much to ask users to edit the MaNGA data into some custom object to get it to load into Jdaviz. I don't believe I don't like the idea of not loading the uncertainty viewer, and presumably the spectral view won't load an extracted spectrum as well. This would effectively make MaNGA data very confusing to use in Cubeviz without lots of context provided back to the user by Jdaviz on how to load. There should be some reasonable defaults and fall backs in place to get the data to load on input, when |
Thank you, Brian. I was hoping you would chime in. Not loading the uncertainty extension is just a patch until a better fix can be in. |
We have no special parser for MANGA. It loads as any other multi-extension FITS would. |
To start having special cases is a slippery slope. Do you really need uncert cube for MANGA analysis? |
We do have specific data loaders for MaNGA in I'm guessing it's adding a unit here? https://github.com/astropy/specutils/blob/f5e708c3efd0ded0dd32b1bc2fc79e7b187a240d/specutils/io/default_loaders/manga.py#L117 |
I actually don't think it is going through jdaviz/jdaviz/configs/cubeviz/plugins/parsers.py Lines 219 to 221 in 3de1b08
Maybe because we wanted the uncert to be in its own viewer, and hence it has to be a separate Spectrum1D object, rather than being attached to the flux Spectrum1D object? (I was not on this team when it was written originally.) I think your ask to go through specutils reader might be a bigger refactor to the whole parser. |
Even if we force the logic to go through Cubeviz Spectrum1D object parser, it is problematic because it blindly assumes flux unit (which is wrong for inverse variance):
|
I did confirmed 2 things loading the cube using code on
|
I think I have a better fix. Closing this. |
Please see #3119 |
Description
This pull request is to fix loading MANGA cube in Cubeviz. Since Brian C said it works on Jdaviz 3.10 series, probably no need to backport.
The problem is the IVAR extension (loaded to uncert) has no BUNIT, so it falls back to
u.count
and now Cubeviz complains about that unit. This patch forces uncert cube to follow flux cube unit ifu.count
(the fallback unit) is detected.Question: Is this assumption safe? IVAR is inverse variance, so theoretically it should be inversion of flux unit squared, right? But if we do that, will spectral extraction fails because the uncert unit then still does not match flux unit?
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.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.