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

not able to read correct unit to JWST spectrum #1143

Open
afaisst opened this issue Jun 14, 2024 · 1 comment
Open

not able to read correct unit to JWST spectrum #1143

afaisst opened this issue Jun 14, 2024 · 1 comment
Labels

Comments

@afaisst
Copy link

afaisst commented Jun 14, 2024

I found that specutils does not read in the correct units for JWST NIRSpec spectra.
Specifically using
spec1d = Spectrum1D.read(filepath)

returns
<Spectrum1D(flux=[0.0 ... 0.0] MJy / sr (shape=(431,), mean=0.25295 MJy / sr); spectral_axis=<SpectralAxis [0.5493196 0.55267611 0.55607917 ... 5.36297138 5.37025765 5.37753207] um> (length=431); uncertainty=StdDevUncertainty)>

note that the flux units it returns are MJy/sr, however, the correct units should be Jy.

Using astropy Table.read:

spec = Table.read(filepath , hdu=1)
spec["FLUX"].unit

returns "Jy".

The file used for this is attached.

jw02565-o001_s09775_nirspec_clear-prism_x1d.fits.zip

@rosteen
Copy link
Contributor

rosteen commented Jun 18, 2024

Thanks for this report. It looks like the reason you're getting MJy/sr is because the header of the file has a SRCTYPE keyword value of "EXTENDED", which means the reader will use the surface brightness column values rather than flux, which would be used for a "POINT" or "UNKNOWN" SRCTYPE.

For now, if you do want to create a Spectrum1D with the flux instead of surface brightness for this file, you can manually grab the flux and wavelength columns and create a Spectrum1D with the flux and spectral_axis keywords (and probably uncertainty) specified. Obviously that's not as convenient, so I'll open an issue to add a keyword to Spectrum1D.read() to override the column that's used for the flux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants