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

Fix bad unit string in some JWST headers to avoid a UnitWarning on read #1050

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

rosteen
Copy link
Contributor

@rosteen rosteen commented Mar 28, 2023

Currently, using Spectrum1D.read() on some JWST X1D files results in the following warning:

WARNING: UnitsWarning: '(MJy/sr)^2' did not parse as fits unit: Syntax error parsing unit '(MJy/sr)^2' If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html [astropy.units.core]

It would be nice if the JWST pipeline used valid strings for all the units, but for now we can work around this by replacing the offending units in the HDU columns. This is the only bad unit I know of at the moment but I coded the replacement as a dictionary so we can add more later if needed.

@rosteen rosteen added the io label Mar 28, 2023
@rosteen rosteen added this to the v1.x milestone Mar 28, 2023
@rosteen
Copy link
Contributor Author

rosteen commented Mar 28, 2023

Doc failure also is appearing on latest before this was opened, unrelated.

@rosteen rosteen requested review from pllim, nmearl, eteq and keflavich March 28, 2023 18:24
Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@rosteen rosteen merged commit 2a7e5aa into astropy:main Mar 28, 2023
rosteen added a commit to rosteen/specutils that referenced this pull request Aug 15, 2023
…ad (astropy#1050)

* Fix bad unit string in some JWST headers to avoid a UnitWarning on read

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

Successfully merging this pull request may close these issues.

2 participants