[INSTRM-1230] Failure writing FITS file Created: 08/Apr/21  Updated: 08/Apr/21  Resolved: 08/Apr/21

Status: Won't Fix
Project: Instrument control development
Component/s: ics_ccdActor
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Critical
Reporter: cloomis Assignee: cloomis
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   
2021-04-07 19:52:44.614Z cmdr             10 CmdrConnection.py:58 read: client.v57.sps 105 ccd_b3 d text="creating fits file /data/raw/2021-04-07/sps/PFLA02450731.fits"
2021-04-07 19:52:44.723Z cmds             20 CommandLink.py:121 > 2 51 w text="failed to write fits file /data/raw/2021-04-07/sps/PFLA02450731.fits: FITSIO status = 402: bad float to string conversion
Error in ffd2e: double value is a NaN or INDEF
"
2021-04-07 19:52:44.724Z exposure         30 exposure.py:386 failed to write fits file /data/raw/2021-04-07/sps/PFLA02450731.fits: FITSIO status = 402: bad float to string conversion
Error in ffd2e: double value is a NaN or INDEF

2021-04-07 19:52:44.728Z cmdr             10 CmdrConnection.py:58 read: client.v57.sps 105 ccd_b3 w text="failed to write fits file /data/raw/2021-04-07/sps/PFLA02450731.fits: FITSIO status = 402: bad float to string conversion"
2021-04-07 19:52:44.729Z cmdr             10 CmdrConnection.py:58 read: .ccd_b3 0 ccd_b3 w RawLine="Error in ffd2e: double value is a NaN or INDEF"
2021-04-07 19:52:44.730Z cmdr             10 CmdrConnection.py:58 read: .ccd_b3 0 ccd_b3 w RawLine="\""


 Comments   
Comment by cloomis [ 08/Apr/21 ]

I allowed a NaN to sneak through to the fits header writer:

(Pdb) p fitsFile.write(im[:1,:1], header=fitsio.FITSHDR(cards[351:352]))
*** OSError: FITSIO status = 402: bad float to string conversion
Error in ffd2e: double value is a NaN or INDEF
(Pdb) p cards[351:352]
[{'name': 'W_SHEXDT', 'value': np.nan, 'comment': '[day] Last hexapod move time'}]
(Pdb) p fitsio.FITSHDR(cards[351:352])

W_SHEXDT=                  nan / [day] Last hexapod move time
Comment by cloomis [ 08/Apr/21 ]

INSTRM-1231 will be the fix.

The trigger was a real float nan keyword value from the dcb. The fitsio FITSHDR constructor does no validation/sanitization, so a KEYNAME = nan FITS card got sent to fitsio.write(). That is not valid, since FITS cannot express NaNs in header cards, so the write failed.

For right now, the dcb actorkeys definition for the hexapodDate declares that "nan" is the invalid value, so that when the ccdActor retrieves the keyword value an exception gets thrown and the standard 9998. NAOJ-approved invalid float value gets passed to fitsio.

And INSTRM-1231 will more generally sanitize FITS card values.

Generated at Sat Feb 10 16:33:13 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.