Skip to content

Conversation

kelle
Copy link
Contributor

@kelle kelle commented Jul 30, 2025

@kelle kelle marked this pull request as draft July 30, 2025 20:06
@kelle
Copy link
Contributor Author

kelle commented Jul 30, 2025

The plotting works in Python but is not working in the webapp.

Error from the webapp

Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSpJ1346-00MIRI.fits [Done]
Error loading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSpJ1346-00MIRI.fits: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:

From a Python console:

Python 3.11.13 (main, Jul  1 2025, 05:28:08) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from specutils import Spectrum
>>> spec = Spectrum.read("https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSpJ1346-00MIRI.fits")
Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSpJ1346-00MIRI.fits
|===============================================================|  14k/ 14k (100.00%)         0s
>>> spec
<Spectrum(flux=[0.000393698138675829 ... 0.000533654813043915] Jy (shape=(262,), mean=0.00052 Jy); spectral_axis=<SpectralAxis [ 4.55848793  4.63696701  4.71290946 ... 12.21127942 12.22842671
 12.2455342 ] um> (length=262); uncertainty=StdDevUncertainty)>

I don't know how to debug this further. @Will-Cooper , advice?

@Will-Cooper
Copy link
Member

The website will be reading the file through the use of astrodbkit:

t_spectra: Table = db.query(db.Spectra).\
        filter(db.Spectra.c.source == query).\
        table(spectra=['access_url'])

My initial thought is that astrodbkit might be pointing to the previous version of specutils, @dr-rodriguez?

@kelle
Copy link
Contributor Author

kelle commented Jul 31, 2025

PR opened in Astrodbkit: astrodbtoolkit/AstrodbKit#106

@dr-rodriguez
Copy link
Collaborator

Examples to consider: 2MASS J16241436+0029158 and 2MASS J13464634-0031501

@dr-rodriguez
Copy link
Collaborator

Capturing the error logs for further investigation. When opening 2MASS J16241436+0029158 I see:

Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00MIRI.fits [Done]
Error loading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00MIRI.fits: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://bdnyc.s3.amazonaws.com/IRS/2MASS+J16241436%2B0029158.fits [Done]
Error loading https://bdnyc.s3.amazonaws.com/IRS/2MASS+J16241436%2B0029158.fits: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://s3.amazonaws.com/bdnyc/SDSS1624%2B0029_SL.txt [Done]
Error loading https://s3.amazonaws.com/bdnyc/SDSS1624%2B0029_SL.txt: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00NIR.fits [Done]
Error loading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00NIR.fits: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://bdnyc.s3.amazonaws.com/WFC3/J1624%2B00.csv [Done]
Error loading https://bdnyc.s3.amazonaws.com/WFC3/J1624%2B00.csv: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://s3.amazonaws.com/bdnyc/SpeX/Prism/1624%2B0029.txt [Done]
Error loading https://s3.amazonaws.com/bdnyc/SpeX/Prism/1624%2B0029.txt: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Downloading https://s3.amazonaws.com/bdnyc/2MASSJ16241436%2B0029158_T6_LRIS_Burg00.txt [Done]
Error loading https://s3.amazonaws.com/bdnyc/2MASSJ16241436%2B0029158_T6_LRIS_Burg00.txt: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
     Format     Read Write Auto-identify
--------------- ---- ----- -------------
     Spex Prism  Yes    No           Yes
wcs1d-multispec  Yes    No           Yes
Re-attempting spectra conversion
Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00MIRI.fits [Done]
Re-attempting spectra conversion
Downloading https://bdnyc.s3.amazonaws.com/IRS/2MASS+J16241436%2B0029158.fits [Done]
Re-attempting spectra conversion
Downloading https://s3.amazonaws.com/bdnyc/SDSS1624%2B0029_SL.txt [Done]
Unable to read https://s3.amazonaws.com/bdnyc/SDSS1624%2B0029_SL.txt. Error: Could not identify column containing the wavelength, frequency or energy
Re-attempting spectra conversion
Downloading https://bdnyc.s3.us-east-1.amazonaws.com/Beiler24/SDSSJ1624%2B00NIR.fits [Done]
Re-attempting spectra conversion
Downloading https://bdnyc.s3.amazonaws.com/WFC3/J1624%2B00.csv [Done]
Unable to read https://bdnyc.s3.amazonaws.com/WFC3/J1624%2B00.csv. Error: Format could not be identified based on the file name or contents, please provide a 'format' argument.
The available formats are:
      Format      Read Write Auto-identify
----------------- ---- ----- -------------
      6dFGS-split  Yes    No           Yes
    6dFGS-tabular  Yes    No           Yes
    APOGEE apStar  Yes    No           Yes
   APOGEE apVisit  Yes    No           Yes
APOGEE aspcapStar  Yes    No           Yes
            ASCII  Yes    No           Yes
             ECSV  Yes    No           Yes
          HST/COS  Yes    No           Yes
         HST/STIS  Yes    No           Yes
             IPAC  Yes    No           Yes
         JWST c1d  Yes    No           Yes
         JWST s2d  Yes    No           Yes
         JWST s3d  Yes    No           Yes
         JWST x1d  Yes    No           Yes
      MUSCLES SED  Yes    No           Yes
       MaNGA cube  Yes    No           Yes
        MaNGA rss  Yes    No           Yes
     SDSS spPlate  Yes    No           Yes
 SDSS-I/II spSpec  Yes    No           Yes
 SDSS-III/IV spec  Yes    No           Yes
    SDSS-V apStar  Yes    No           Yes
   SDSS-V apVisit  Yes    No           Yes
       SDSS-V mwm  Yes    No           Yes
      SDSS-V spec  Yes    No           Yes
 Subaru-pfsObject  Yes    No           Yes
             iraf  Yes    No           Yes
     tabular-fits  Yes   Yes           Yes
       wcs1d-fits  Yes   Yes           Yes
Re-attempting spectra conversion
Downloading https://s3.amazonaws.com/bdnyc/SpeX/Prism/1624%2B0029.txt [Done]
Unable to read https://s3.amazonaws.com/bdnyc/SpeX/Prism/1624%2B0029.txt. Error: Could not identify column containing the wavelength, frequency or energy
Re-attempting spectra conversion
Downloading https://s3.amazonaws.com/bdnyc/2MASSJ16241436%2B0029158_T6_LRIS_Burg00.txt [Done]
Unable to read https://s3.amazonaws.com/bdnyc/2MASSJ16241436%2B0029158_T6_LRIS_Burg00.txt. Error: Could not identify column containing the wavelength, frequency or energy

I'm not sure why the initial attempt is not considering all possible formats and only uses the ones defined in astrodbkit. Maybe the more recent versions of specutils need something to be set so that it includes default loaders as well.

Regardless, the MIRI spectra is ultimately loaded. The errors are from the txt and csv files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

some JWST spectra won't plot

3 participants