You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bad checksum not being overwritten on call to "writeto" #5902
I modified the CHECKSUM header of checksum.fits and added CHECKSUM to test0.fits and modified it's CHECKSUM header too. (i.e. 16 letter long garbage value).
Opened and overwrote both the files. Correct CHECKSUMs were written only for test0.fits
What would be the correct behaviour here? I mean output_verify is False and the checksum parameter was "sort of" True. However the checksum parameter only says "When True adds both DATASUM and CHECKSUM cards to the headers of all HDU’s written to the file.", does that mean it should always overwrite the existing DATASUM and CHECKSUM or just add them if not present?
I mean the test case is a bit theoretical: If you explicitly garbage the CHECKSUM and don't check it when reading the file what's the point about "correcting" it when writing the file again?
The documentation of checksum in fits.open is this:
If True, verifies that both DATASUM and CHECKSUM card values (when present in the HDU header) match the header and data of all HDU’s in the file. Updates to a file that already has a checksum will preserve and update the existing checksums unless this argument is given a value of ‘remove’, in which case the CHECKSUM and DATASUM values are not checked, and are removed when saving changes to the file.
That actually means (in my opinion) that when you suspect a "garbage" checksum you should provide checksum='remove' when reading the file and checksum=True when writing it again.
I'd have to take a closer look, but it's a known (to me) issue that checksum handling is confusing. I believe there may already be some open tickets about this either here or in the old PyFITS repo. Which is not to say the behavior isn't deliberate. It's just confusing.
does that mean it should always overwrite the existing DATASUM and CHECKSUM or just add them if not present
I think this means it should overwrite. DATASUM and CHECKSUM are two of those "special" header keywords that nobody should ever touch manually without very good reason to.
My other issues and pending PRs are all related to this issue. Pending
because of a number of confusions. I'll go back to them and post a compiled
comment.
On May 3, 2017 6:26 PM, "Erik Bray" ***@***.***> wrote:
I'd have to take a closer look, but it's a known (to me) issue that
checksum handling is confusing. I believe there may already be some open
tickets about this either here or in the old PyFITS repo. Which is not to
say the behavior isn't deliberate. It's just *confusing*.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5902 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AOc7f1Ua-5w_toR1fhUdja8fzypmSnjjks5r2Hl6gaJpZM4Mm4Hw>
.
Activity
mohanagr commentedon Apr 28, 2017
@pllim @Cadair @saimn Any updates for this?
P.S. Apologies for tagging you all. Don't quite know who maintains what.
pllim commentedon Apr 28, 2017
Trying my luck on additional @embray and @MSeifert04 .
cadairis not involved in FITS and I have little to say about this topic.MSeifert04 commentedon Apr 28, 2017
What would be the correct behaviour here? I mean
output_verifyisFalseand thechecksumparameter was "sort of"True. However thechecksumparameter only says "When True adds both DATASUM and CHECKSUM cards to the headers of all HDU’s written to the file.", does that mean it should always overwrite the existing DATASUM and CHECKSUM or just add them if not present?I mean the test case is a bit theoretical: If you explicitly garbage the CHECKSUM and don't check it when reading the file what's the point about "correcting" it when writing the file again?
The documentation of
checksuminfits.openis this:That actually means (in my opinion) that when you suspect a "garbage" checksum you should provide
checksum='remove'when reading the file andchecksum=Truewhen writing it again.embray commentedon May 3, 2017
I'd have to take a closer look, but it's a known (to me) issue that checksum handling is confusing. I believe there may already be some open tickets about this either here or in the old PyFITS repo. Which is not to say the behavior isn't deliberate. It's just confusing.
embray commentedon May 3, 2017
I think this means it should overwrite. DATASUM and CHECKSUM are two of those "special" header keywords that nobody should ever touch manually without very good reason to.
mohanagr commentedon May 3, 2017
saimn commentedon Sep 25, 2017
Fixed by #6571