Пример #1
0
#calculating the flux and the area in each elliptical annulus
apers = []
area  = []
for ii in range(len(aa)):
    """ THIS WORKED WELL AS WELL
    ellip_aper = EllipticalAperture(centroid, aa[ii], bb[ii], position_angle)
    area = ellip_aper.area()
    flux.append(aperture_photometry(image, ellip_aper, error = rms_image))
    """
    if ii == 0:
        ellip_annulus = EllipticalAnnulus(centroid,       0,aa[ii],bb[ii],position_angle)
    else:
        ellip_annulus = EllipticalAnnulus(centroid,aa[ii-1],aa[ii],bb[ii],position_angle)
    apers.append(aperture_photometry(image, ellip_annulus, error = rms_image))
    area_annulus = ellip_annulus.area()
    area.append(area_annulus)
    #I plot the apertures
    ellip_annulus.plot(ax=ax)

#area's rows are scalars, but flux rows are aperture_photometry tables, and I need to join all of them. I get this by doing
table_apers = hstack(apers)

#printing the image with the apertures
plt.savefig("pyapertures.pdf")
plt.close()
plt.clf()

#create two vectors, one with the fluxes per area and the other with the error in the fluxes per area
flux       = np.zeros(resolution)
sigma_flux = np.zeros(resolution)
Пример #2
0
if show_images:
    annuli_c.plot(color='blue', lw=2)
    plt.imshow(quadRU_data,
               origin='lower',
               norm=norm,
               cmap='BrBG',
               clim=(0, 1000))
    plt.show()
    plt.clf()

##background subtraction

##ellip annuli background subtraction
apers = [apertures, annuli, annuli_c]
phot_table = aperture_photometry(quadRU_data, apers)
background_mean_ellip = phot_table['aperture_sum_1'] / annuli.area()
background_sum_ellip = background_mean_ellip * apertures.area()
final_sum_ellip = phot_table['aperture_sum_0'] - background_sum_ellip
phot_table['residual_aperture_sum'] = final_sum_ellip
print(phot_table['residual_aperture_sum'])

##circ annuli background subtraction
apers = [apertures, annuli, annuli_c]
phot_table = aperture_photometry(quadRU_data, apers)
background_mean_circ = phot_table['aperture_sum_2'] / annuli.area()
background_sum_circ = background_mean_circ * apertures.area()
final_sum_circ = phot_table['aperture_sum_0'] = background_sum_circ
phot_table['residual_aperture_sum'] = final_sum_circ
print(phot_table['residual_aperture_sum'])

##background comparison