我想在 UV FITS 文件上绘制不同区域的椭圆孔,用于长轴和短轴和 theta 的不同值,长轴与正 x 方向的角度。我有一组值来定义所需的光圈中心、相应的主轴和次轴以及 theta 值。我附上我写的代码。但是,在定义光圈时,它不接受数组作为长轴、短轴或 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()