I have this script that makes a file with multiple extensions, but I would like to add headers from the old files to the extensions.
new_hdul = fits.HDUList()
new_hdul.append(fits.PrimaryHDU(header=headermain))
new_hdul.append(fits.ImageHDU(nod1, header=header1, name='Chop1'))
new_hdul.append(fits.ImageHDU(nod2, header=header2, name='Chop2'))
new_hdul.append(fits.ImageHDU(diff1, name='Dif'))
Now I have tried:
headermain = fits.getheader(file,0)
and
headermain = fits.open(file).header.copy()
But both give me errors saying that
ValueError: header must be a Header object
How can I fix this?
headermain = fits.getheader(file,0)
print(headermain)
see http://pastebin.com/JXki7EPV
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…