I'm trying to create a new FITS file out of two older ones using PyFITS.
import pyfits
from sys import stdout
from sys import argv
import time
file1 = argv[1]
file2 = argv[2]
hdu1 = pyfits.open(file1)
hdu2 = pyfits.open(file2)
new0 = hdu1[0]
new1 = hdu1[0]
sci1 = hdu1[0].data
sci2 = hdu2[0].data
for r in range(0, len(sci1)):
for c in range(0, len(sci1[r])):
add = sci1[r][c] + sci2[r][c]
new0.data[r][c] = add
for r in range(0, len(sci1)):
for c in range(0, len(sci1[r])):
print "(" + str(r) + ", " + str(c) + ") FirstVal = " + str(sci1[r][c]) + " || SecondVal = " + str(sci2[r][c])
print "\t New File/Add = " + str(new0.data[r][c])
All it prints out is the first value, i.e. sci1[r][c]
. This means that the variable isn't being modified at all. How can I make it modify? I'm very new to using FITS.