1

I want to plot elliptical apertures in different regions on a UV FITS file, for different values for major and minor axes and theta, the angle made by the major axis with positive x-direction. I have an array of values to define the required center for the aperture, the corresponding major and minor axes, and theta values. I'm attaching the code I wrote. However, when defining the aperture, it doesn't accept an array as an eligible value for the major axis, minor axis, or theta.

major1 = uvit['R100'] #R100 is the major axis
axrat1= uvit['axrat'] #axrat are the corresponding axis ratio values
angle1= uvit['ang'] # theta to define angle b/w major axis and +ve x-dir
major = [0]*1429
minor = [0]*1429
theta = [0]*1429
centx = [0]*1429
centy = [0]*1429

for i in range (0,len(xuv)):
    pixx, pixy = w1.wcs_world2pix(xuv[i],yuv[i] , 1)
    centx[i]=pixx
    centy[i] = pixy
    major[i] = major1[i]
    minor[i] = major1[i]*axrat1[i]
    theta[i] = math.radians(angle1[i])
pos = np.vstack((centx, centy)).T

apertcent3=EllipticalAperture(pos, major, minor, theta)
apertcent3.plot(color='#0547f9', lw=3)

norm = simple_norm(data, 'sqrt', percent=99.9)
plt.imshow(data, cmap='Greys_r', origin='lower', norm=norm)





plt.xlim(0, data.shape[1]-1)
plt.rcParams["figure.figsize"] = [50,50]
plt.show()

1 Answers1

0

According to the docs for EllipticalAperture as you indeed noted it does not accept arrays for major/minor axis.

You would instead need to loop over all (major, minor) pairs, create an EllipticalAperture, and plot each one separately.

Iguananaut
  • 21,810
  • 5
  • 50
  • 63
  • Thank you for the help! I looped over the different parameters and plotted the apertures. Had an issue when I was plotting every aperture inside the loop only, making my routine rather heavy to run. I edited the routine to calculate all apertures first and then plot on the FITS file together. – SlightDecoy Mar 30 '21 at 09:37