def aperture_ring(radius_arcsec,wcs): a_in=radius_arcsec-1.5 a_out=radius_arcsec b_out=a_out*incl ring_sky=SkyEllipticalAnnulus(position,a_in=a_in*u.arcsec,a_out=a_out*u.arcsec,b_out=b_out*u.arcsec,theta=PA*u.degree) ring_pix=ring_sky.to_pixel(wcs=wcs) return ring_pix
def aperture_ring(radius_in,radius_out,wcs): a_in=radius_in a_out=radius_out b_out=a_out*incl ring_sky=SkyEllipticalAnnulus(center,a_in=a_in*u.arcsec,a_out=a_out*u.arcsec,b_out=b_out*u.arcsec,theta=PA*u.degree) ring_pix=ring_sky.to_pixel(wcs=wcs) return ring_pix
def aperture_rings(a_in, a_out, wcs, cosi, pa): ring_sky = SkyEllipticalAnnulus(positions=center, a_in=a_in * u.arcsec, a_out=a_out * u.arcsec, b_out=a_out * cosi * u.arcsec, theta=pa * u.degree) ring_pix = ring_sky.to_pixel(wcs=wcs) return ring_pix
size=u.Quantity((54,42),u.arcsec) cut=Cutout2D(data=data,position=position,size=size,wcs=wcs) data_cut=cut.data # mask the data. data_masked=np.ma.masked_invalid(data_cut) mask=data_masked.mask co12_masked=data_masked # draw the apertures in the image position=SkyCoord(dec=50.415*u.arcmin,ra=204.9705*u.degree,frame='icrs') apertures['center']['sky']=SkyEllipticalAperture(position,a=2*u.arcsec,b=3*u.arcsec,theta=0*u.degree) apertures['center']['pix']=apertures['center']['sky'].to_pixel(wcs=cut.wcs) apertures[regions[1]]['sky']=SkyEllipticalAnnulus(position,a_in=2*u.arcsec,a_out=4*u.arcsec,b_out=6*u.arcsec,theta=0*u.degree) apertures[regions[1]]['pix']=apertures[regions[1]]['sky'].to_pixel(wcs=cut.wcs) apertures[regions[2]]['sky']=SkyEllipticalAnnulus(position,a_in=4*u.arcsec,a_out=6*u.arcsec,b_out=9*u.arcsec,theta=0*u.degree) apertures[regions[2]]['pix']=apertures[regions[2]]['sky'].to_pixel(wcs=cut.wcs) apertures[regions[3]]['sky']=SkyEllipticalAnnulus(position,a_in=6*u.arcsec,a_out=9*u.arcsec,b_out=13.5*u.arcsec,theta=0*u.degree) apertures[regions[3]]['pix']=apertures[regions[3]]['sky'].to_pixel(wcs=cut.wcs) apertures[regions[4]]['sky']=SkyEllipticalAnnulus(position,a_in=9*u.arcsec,a_out=15*u.arcsec,b_out=22.5*u.arcsec,theta=0*u.degree) apertures[regions[4]]['pix']=apertures[regions[4]]['sky'].to_pixel(wcs=cut.wcs) fig=plt.figure() ax=plt.subplot(projection=cut.wcs) ax.imshow(data_cut,cmap='gray',origin='lower') apertures['center']['pix'].plot(color='red')
wcs_cut = cut_2d(data, center, size, wcs)[0] data_cut = cut_2d(data, center, size, wcs)[1] fitsimage = '../test3/run3/maps/NGC_5258_local_1mom.fits' model = fits_import(fitsimage)[1] model_cut = cut_2d(model, center, size, wcs)[1] # draw rings a_in = 4 * u.arcsec a_out = 8 * u.arcsec b_out = a_out * 0.5 theta = 204 * u.deg ring_sky = SkyEllipticalAnnulus(positions=center, a_in=a_in, a_out=a_out, b_out=b_out, theta=theta) ring_pix = ring_sky.to_pixel(wcs_cut) phi = 204 xmax = 360 xmin = 0 ymax = 360 ymin = 0 xcen = 180 ycen = 180 x = np.arange(0, xmax - xmin, 0.1) y = np.tan(np.radians(phi - 90)) * (x - xcen) + ycen fig = plt.figure()