如何为一系列长轴和短轴的值绘制椭圆孔径?

问题描述

我想在 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()

解决方法

根据 EllipticalAperture 的文档,您确实注意到它不接受长/短轴数组。

您需要遍历所有(主要、次要)对,创建一个 EllipticalAperture,然后分别绘制每个对。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...