I am trying to update an existing fits table with pyfits. It is working fine for some columns of the table, unfortunately not for the first column. Here is the columns definition:
ColDefs(
name = 'EVENT_ID'; format = '1J'; bscale = 1; bzero = 2147483648
name = 'TEL_ID'; format = '1I'
name = 'TIMESLICE'; format = '1I'; null = 0...
And the simple code fragment to update it:
event = pyfits.open('file.fits.gz')[1]
event.data.field('EVENT_ID')[0] = np.uint32(event.event_ID)
event.data.field('TEL_ID')[0] = int(tel.ID[2])
event.writeto('test.fits')
Writing TEL_ID (and others not shown here) works, EVENT_ID does not. I already tried different formats (np.int32, int) but always the same...
type(event.data.field('EVENT_ID')[0])
returns numpy.uint32 (for the unmodified file)
Thanks for your help
Edit:
If I change the definition of 'EVENT_ID', leaving out 'bscale' and 'bzero' the update of the value works. So it seems there is a problem with the unsigned integer.