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
Changes to integer column values with bzero set in opened fits tables are not written back to file #6887
c1=pf.Column(name='c1',array=np.array([1],dtype='>i2'),format='1I',bscale=1,bzero=32768)
S=pf.HDUList([pf.PrimaryHDU(),pf.BinTableHDU.from_columns([c1])])
print("S=",S[1].data)
# Change value in memoryS[1].data['c1'][0]=2print("S=",S[1].data)
print(S[1].columns)
S.writeto("a.fits")
S.close()
S= [(1,)]
S= [(2,)]
ColDefs(
name = 'c1'; format = '1I'; bscale = 1; bzero = 32768
)
X=pf.open("a.fits")
print("a.fits=",X[1].data)
print(X[1].columns)
# Change value in memoryX[1].data['c1'][0]=10print("X=",X[1].data)
# Write back to fileX.writeto("b.fits")
X.close()
#Now check the fileprint("b.fits=",pf.open("b.fits")[1].data)
So if we read in a fits file with bzero set in one column that column can be changed in memory but this is not written back to file by HDUList.writeto(). In case of multiple columns, string and float column changes are written out properly. Without the bzero argument, changes are written out properly.
Activity
saimn commentedon Dec 6, 2017
I think I get it, the column is converted but not marked as such, so when writing to a file it is not scaled back. I will finalize a fix later.