specutils icon indicating copy to clipboard operation
specutils copied to clipboard

JWST spectrum reading question

Open keflavich opened this issue 6 months ago • 1 comments

Loading a JWST spectrum, I get data with MJy/sr units:

>>> spec = specutils.Spectrum.read('jw05804-o039_t011_nirspec_prism-clear/jw05804-o039_t011_nirspec_prism-clear_x1d.fits')
>>> spec.unit
Unit("MJy / sr")

but the flux column has Jy units:

    WAVELENGTH              FLUX                FLUX_ERROR      FLUX_VAR_POISSON FLUX_VAR_RNOISE FLUX_VAR_FLAT     SURF_BRIGHT      ...   DQ        BACKGROUND          BKGD_ERROR     BKGD_VAR_POISSON BKGD_VAR_RNOISE BKGD_VAR_FLAT NPIXELS
        um                   Jy                     Jy                Jy2              Jy2            Jy2            MJy / sr       ...              MJy / sr            MJy / sr         (MJy/sr)^2       (MJy/sr)^2     (MJy/sr)^2
     float64              float64                float64            float64          float64        float64          float64        ... uint32       float64             float64           float64          float64        float64    float64
------------------ ---------------------- --------------------- ---------------- --------------- ------------- -------------------- ... ------ ------------------- ------------------- ---------------- --------------- ------------- -------
0.6025000237859786 4.6011916422906044e-05 5.013773555819315e-05              0.0             0.0           0.0 0.045096075097084465 ...      0 0.07041636376462115 0.04816933753815392              0.0             0.0           0.0  4341.0
0.6075000236742198  8.339269703115367e-05 2.940493824189401e-05              0.0             0.0           0.0  0.08173281228497456 ...      0 0.10750291443929709 0.02761201367018343              0.0             0.0           0.0  4341.0

Is this a bug? The tests seem to imply that the units should be Jy: https://github.com/astropy/specutils/blob/31f71125fa93b78f8752ff10e84ba5ef3c861f83/specutils/tests/test_loaders.py#L1752-L1767

keflavich avatar Jun 25 '25 23:06 keflavich

Duplicate of https://github.com/astropy/specutils/issues/1143

keflavich avatar Jun 25 '25 23:06 keflavich

Is this fixed by #1244? Would the modified code be

spec = specutils.Spectrum.read('jw05804...fits', flux_col="flux")

kelle avatar Jul 17 '25 18:07 kelle

Is this fixed by #1244? Would the modified code be

spec = specutils.Spectrum.read('jw05804...fits', flux_col="flux")

Yes, forgot to close this and the other issue when I merged that. Thanks for the reminder.

rosteen avatar Jul 22 '25 13:07 rosteen