The code is as follows:
from astropy.io import fits
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
hdu = fits.open('1/img/r1464838.fit')
hdu[1].header
img = hdu[1].data
print(img.shape)
hdu1 = fits.open('MCtest_C1.fits')
coeff=hdu1
for i in range(1024):
for j in range(1024):
nonlin = coeff[0,i,j]*img**3 + coeff[1,i,j]*img**2 + coeff[2,i,j]*img**1 + coeff[3,i,j]*img**0
print(nonlin)
corrected_img = (filelist)/nonlin
The issue appears to arise on the nonlin
line. Not too sure how to go about fixing this problem.
Any help would be great.
Thanks!