我正在使用 photoutils 进行光圈测光。我遵循了 photutils 页面中的教程,从源周围的圆形环计算背景并将其减去。现在我必须计算光度测量的误差,但是,aperture_photometry 任务不会给出光圈误差或背景误差,除非我给它一个输入误差。我应该给任务什么输入错误?为了获得光圈测光,我使用了以下代码:
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']
任何关于如何获得错误的想法将不胜感激。最好的祝愿。萨拉