Don't log when passed unit matches FITS BUNIT#19389
Don't log when passed unit matches FITS BUNIT#19389m4cd4r4 wants to merge 7 commits intoastropy:mainfrom
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
Probably need regression test. |
| fits_unit_parsed = u.Unit(fits_unit_string) | ||
| except ValueError: | ||
| fits_unit_parsed = None | ||
| if fits_unit_parsed is None or fits_unit_parsed != u.Unit(unit): |
There was a problem hiding this comment.
I would prefer a comparison of the string units as in #18678 rather than trying to parse the unit. There are some "valid" fit unit strings that do not immediately translate into astropy units.
|
Done - switched to |
Co-authored-by: Evan Warnock <176846909+Warnocke@users.noreply.github.com>
34c476d to
f72e2f8
Compare
|
Done - rebased onto main and added @Warnocke as co-author on the last commit. |
|
Friendly ping @mwcraig - this has been ready for re-review since 2026-03-25 (rebase + co-author both done). No rush, just flagging in case it slipped through. Happy to make any further adjustments. |
|
Actually, I take that back -- no rebase is needed |
| @@ -0,0 +1 @@ | |||
| Fixed \CCDData.read\ logging a spurious info message when the unit passed by the caller matches the \BUNIT\ value in the FITS header. | |||
There was a problem hiding this comment.
| Fixed \CCDData.read\ logging a spurious info message when the unit passed by the caller matches the \BUNIT\ value in the FITS header. | |
| Fixed ``CCDData.read()`` logging a spurious info message when the unit passed by the caller matches the BUNIT value in the FITS header. |
There was a problem hiding this comment.
Applied in 6e15ec5 - switched to RST double backticks. Thanks for catching that.
Description
Description
Don't log when passed unit matches FITS BUNIT
CCDData.readlogs an info message whenever aunitargument is passed alongside a FITS file that has aBUNITheader, even when they match. This is noisy when users explicitly pass the unit to confirm what's already in the file.The log now only fires when the two units actually differ.
Fixes #13539