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) for ii in range(resolution): keyword = 'aperture_sum_'+str(ii+1)
clim=(0, 1000)) plt.show() plt.clf() ##Use EllipticalAnnulus annuli = EllipticalAnnulus(star_coords, a_in=5.5, a_out=7, b_out=6, theta=np.pi / 4) print("Elliptical Annuli", annuli) phot_table_ellip = aperture_photometry(quadRU_data, annuli, method='exact') print("phot_table_ellip", phot_table_ellip) if show_images: annuli.plot(color='blue', lw=2) plt.imshow(quadRU_data, origin='lower', norm=norm, cmap='BrBG', clim=(0, 1000)) plt.show() plt.clf() ##use CircularAnnulus annuli_c = CircularAnnulus(star_coords, r_in=5.5, r_out=7) print("Circular Annuli", annuli_c) phot_table_circ = aperture_photometry(quadRU_data, annuli_c, method='exact') print("phot_table_circ", phot_table_circ) if show_images: annuli_c.plot(color='blue', lw=2)