-
Notifications
You must be signed in to change notification settings - Fork 75
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] Wrong WCS mapping when reading from Spectrum1D #3117
Comments
I think this is because Spectrum1D likes to move the spectral axis to a certain place. As a result, the spatial indexing gets messed up in a way that it is Do the test cases here help explain? Line 102 in 3de1b08
Line 206 in 3de1b08
|
@WenkeRen Thanks for the detailed and reproducible bug report, I'm looking into this. As @pllim said, currently specutils swaps the spectral axis to last, and there's a small possibility we haven't been handling this correctly for the display - most of our test cases are pretty square in the spatial directions and I want to make sure this didn't slip past us. Either way, yes @pllim specutils 2.0 should make this simpler to handle. |
Pretty sure we are transposing internally. Example: jdaviz/jdaviz/configs/imviz/plugins/coords_info/coords_info.py Lines 228 to 234 in 3de1b08
|
I think this is a real bug, but specifically with the flux = np.moveaxis(flux, 1, 0) This is a very easy fix, and in fact I remove that line in the specutils 2.0 compatibility PR (see here), but it seems like it never should have been there in the first place. I'm going to do some more thinking to make sure it's really not needed. |
Oh, thanks for investigating. If we remove it, I think we also have to remove the workarounds we been putting in to compensate for it. 😅 Though, I think it was put in because user was complaining image looked transposed compared to a different cube viewer. We should definitely also double check that too. |
Jdaviz component
Cubeviz
Description
Following the instruction of Importing Data into Cubeviz, I found there are some inconsistency between the wcs in the Spectrum1D module and that passed to Cubeviz. To me, it seems that Cubeviz reversed the RA and DEC diagonally. Personally, I suspect it could due to the Spectrum1D will somehow rearrange the data sequence from [WAVE, DEC, RA] to [RA, DEC, WAVE], but I do not have ability to locate this issue further.
I gave a simple example for your quick look below.
How to Reproduce
Expected behavior
Put these code into a jupyter notebook, you will get a interactive plot from cubeviz. From the flux-viewer, we can see the image have 5 pixels along RA direction and 10 along DEC direction. But the input data cube is in reverse.
Browser
Chrome 126.0.6478.127 (arm64)
Jupyter
IPython : 8.26.0
ipykernel : 6.29.5
ipywidgets : 8.1.3
jupyter_client : 8.6.2
jupyter_core : 5.7.2
jupyter_server : 2.14.2
jupyterlab : 4.2.3
nbclient : 0.7.4
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.2.1
qtconsole : 5.5.2
traitlets : 5.14.3
Software versions
macOS-14.4.1-arm64-arm-64bit
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ]
Numpy 1.26.4
astropy 6.1.1
matplotlib 3.8.4
scipy 1.14.0
scikit-image 0.24.0
asdf 3.3.0
stdatamodels 2.0.0
gwcs 0.21.0
regions 0.9
specutils 1.15.0
specreduce 1.3.0
photutils 1.13.0
astroquery 0.4.7
pyyaml 6.0.1
asteval 1.0.1
idna 3.7
traitlets 5.14.3
bqplot 0.12.43
bqplot-image-gl 1.4.11
glue-core 1.21.1
glue-jupyter 0.22.0
glue-astronomy 0.10.0
echo 0.9.0
ipyvue 1.11.1
ipyvuetify 1.9.4
ipysplitpanes 0.2.0
ipygoldenlayout 0.4.0
ipypopout 1.2.1
Jinja2 3.1.4
voila 0.4.5
vispy 0.14.3
sidecar 0.7.0
Jdaviz 3.10.2
The text was updated successfully, but these errors were encountered: