-
Notifications
You must be signed in to change notification settings - Fork 6
Fix JWST spectra plotting #192
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
Conversation
|
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? |
|
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? |
|
PR opened in Astrodbkit: astrodbtoolkit/AstrodbKit#106 |
|
Examples to consider: 2MASS J16241436+0029158 and 2MASS J13464634-0031501 |
|
Capturing the error logs for further investigation. When opening 2MASS J16241436+0029158 I see: 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes here were Ruff import sorting. I did explicitly add from specutils import Spectrum
| t_spectra: Table = db.query(db.Spectra).\ | ||
| filter(db.Spectra.c.source == query).\ | ||
| table(spectra=['access_url']) | ||
| table() # do not use spectra=['access_url'] here, it will try to read the spectra as Spectrum objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing and is required to prevent astrodbkit from auto-converting the spectra, that is done manually now in line 178
| pytest==8.3.4 | ||
| requests==2.32.4 | ||
| specutils==2.0.0 | ||
| specutils==2.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JWST spectra was still not working with 2.0.0, but 2.2.0 works well
Closes some JWST spectra won't plot #184 .