I have a fits file that I have open and closed and then produced a spectrum of one single spot within this image. I now need to create a loop and add the spaxels within some area together to produce a stacked spectrum. Any ideas of how I would do this?
hdul=fits.open('ADP.2016-09-08T02:00:17.312.fits')
hdul.info()
cube=hdul[1].data
print(np.shape(cube))
#cube[:. iy, ix]
header=hdul[1].header wave=header['CRVAL3']+np.arange(header['NAXIS3'])*header['CD3_3']
print(wave)
hdul.close
plt.close('all')
fig=plt.figure()
ax=fig.add_subplot(111)
fig.set_figwidth(15)
ax.set_ylim(1,1e4)
ax.set_yscale('log')
ax.set_xlim(4800,6900)
ax.plot(wave,cube[:, 53-1,237-1],linewidth=0.75)
fig.tight_layout()
source https://stackoverflow.com/questions/72034891/how-to-combine-spaxels-together-within-an-area-of-a-fits-file
Comments
Post a Comment