从半径为 R1 和 R2 的圆环内的图像中提取数据点

Extract data points from image within an annulus with radius R1 and R2

我有一张尺寸为 3000 * 3000 像素的图像。我首先找到我感兴趣的区域的中心,比如位置 (1000,2000)。我想提取 R1 = 10 像素、R2 = 20 像素的环内数据,并找到环内数据的模式。有没有 python 例程可以做到这一点,或者有任何聪明简洁的方法来实现它?我知道 photutils.aperture_photometry 可以获得环面的总和,但不是每个像素的任何单独数据点。

import numpy as np
data = np.random.uniform(0,10,size=(3000,3000))
center = (1000,2000)    #### in pixel space
R1 = 10   #### pixels
R2 = 20   #### pixels
....

没有任何答案……惊呆了。我有非常简单的两个循环函数来做到这一点。

imin = center[0] - R2
imax = center[0] + R2 + 1
jmin = center[1] - R2
jmax = center[1] + R2 + 1
target = []
for i in np.arange(imin, imax):
    for j in np.arange(jmin, jmax):
        ij = np.array([i,j])
        dist = np.linalg.norm(ij - np.array(center))
        if dist > R1 and dist <= R2:
            target.append([i,j,data[i][j]])
target = np.array(target)

有更好的实现方式吗?