def SubFluxOperation(y):
print(galaxies[y])
collection = ['F475W','F814W','F160W']
flux = np.zeros([len(collection),len(radii)]) #*u.Jy
subflux = np.zeros([len(collection),len(radii)])
for i in range (0, len(collection)):
# read in the images
file = glob.glob(dir+galaxies[y]+'_final_'+collection[i]+'*sci.fits')
hdu = fits.open(file[0])
data[i], header[i] = hdu[0].data, hdu[0].header
fnu[i] = header[i]['PHOTFNU']
exp[i] = header[i]['EXPTIME']
#define positions for photometry
positions = [(xcen[y], ycen[y])]
#do photometry on images
#convert to proper units
for j in range(0,len(radii)):
aperture = CircularAperture(positions, radii[j])
phot_table = aperture_photometry(data[i], aperture)
#the next line changes the data from its original e-/s to something else that i don't remember.... because i suck.
flux[i,j] = phot_table['aperture_sum'][0]*(fnu[i]/exp[i])
if j == 0:
subflux[i,j] = flux[i,j]
else:
subflux[i,j] = flux[i,j]-flux[i,j-1]
return(subflux)
# now let's put stuff in the data structure we created
评论列表
文章目录