Skip to content
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

[BUG] Specviz: Cannot display spectrum with one flux value throughout if value is larger than 1 #1172

Closed
pllim opened this issue Mar 15, 2022 · 0 comments
Labels
bug Something isn't working specviz

Comments

@pllim
Copy link
Contributor

pllim commented Mar 15, 2022

Original context

@camipacifici wanted to load jw01090001001_01101_00049_nis_uncal.fits into Cubeviz using #1040 . This file probably has saturated pixel (65535) at every slice, so the resultant 1D spectrum at maximum (the default) triggered this bug. If you change the statistic to something that doesn't give you all the same values (e.g., mean), the spectrum viewer will show something.

Filename: jw01090001001_01101_00049_nis_uncal.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     126   ()      
  1  SCI           1 ImageHDU        50   (2048, 2048, 5, 1)   int16 (rescales to uint16)   
  2  ZEROFRAME     1 ImageHDU        12   (2048, 2048, 1)   int16 (rescales to uint16)   
  3  GROUP         1 BinTableHDU     36   5R x 13C   [I, I, I, J, I, 26A, I, I, I, I, 36A, D, D]   
  4  INT_TIMES     1 BinTableHDU     24   1R x 7C   [J, D, D, D, D, D, D]   
  5  ASDF          1 BinTableHDU     11   1R x 1C   [6833B]   

Note to self: Had to pass in pf[1].data, not the filename because its WCS is bad (2D, not 3D) but that is a different problem for another day.

To Reproduce
Steps to reproduce the behavior:

from astropy import units as u
from specutils import Spectrum1D

sp = Spectrum1D(flux=([1.1] * 5) * u.Jy)

specviz = Specviz()
specviz.load_data(sp, data_label='test')
specviz.app

Screenshot 2022-03-15 164826

You can see it drawn if it is between 0 and 1, inclusive:

from astropy import units as u
from specutils import Spectrum1D

from jdaviz import Specviz

sp = Spectrum1D(flux=([1] * 5) * u.Jy)

specviz = Specviz()
specviz.load_data(sp, data_label='test')
specviz.app  # Note the line right at 1.0e+0

Screenshot 2022-03-15 164944

Things work if the values are not all the same:

from astropy import units as u
from specutils import Spectrum1D

from jdaviz import Specviz

sp = Spectrum1D(flux=[1.1, 1, 1.1, 1.1, 1.1] * u.Jy)

specviz = Specviz()
specviz.load_data(sp, data_label='test')
specviz.app

Screenshot 2022-03-15 165328

Expected behavior

Y-axis to be smarter and re-adjust when flux > 1 and all the values in the flux array are the same.

🐱 🐱

@pllim pllim added bug Something isn't working specviz labels Mar 15, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working specviz
Projects
None yet
Development

No branches or pull requests

2 participants