I am performing aperture photometry using photutils. I've followed the tutorials in the photutils page, calaculated the background from a circular annulus around the source and subtracted it. Now I have to calculate the error on the photometry, but the aperture_photometry task doesn't give the apertures errors nor the background error unless I give it an input error. What input error should I give the task? To obtain the aperture photometry I've used the following code:
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from matplotlib.colors import LogNorm
from astropy.stats import sigma_clipped_stats
from photutils import aperture_photometry
from photutils import CircularAnnulus
from photutils import CircularAperture
image = fits.open('cut_F555_03.fits')
hdu_list = image
image_data = hdu_list[0].data
import pandas as pd
sources = pd.read_csv('daofind.tab', delimiter = '\s+', header = 0)
loc = np.array([sources['xcentroid'], sources['ycentroid']])
positions = np.transpose(loc)
apertures = CircularAperture(positions, r = 8.12)
rawflux = aperture_photometry(image_data, apertures)
annulus_apertures = CircularAnnulus(positions, r_in = 8.12, r_out = 18.12)
annulus_masks = annulus_apertures.to_mask(method = 'center')
bkg_median = []
for mask in annulus_masks:
annulus_data = mask.multiply(image_data)
annulus_data_1d = annulus_data[mask.data > 0]
_, median_sigclip, _ = sigma_clipped_stats(annulus_data_1d)
bkg_median.append(median_sigclip)
bkg_median = np.array(bkg_median)
rawflux['annulus_median'] = bkg_median / annulus_apertures.area
rawflux['aper_bkg'] = bkg_median * apertures.area
rawflux['final_phot'] = rawflux['aperture_sum'] - rawflux['aper_bkg']
Any idea on how to obtain the errors would be really appreciated. Best wishes. Sara