You can pad your array. Filling will expand your array with the desired boundary conditions (see Parameter modefor all possible options):
>>> A = np.array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> N = 5
>>> B = np.pad(A, N//2, mode='reflect')
>>> B
array([[10, 9, 8, 9, 10, 11, 10, 9],
[ 6, 5, 4, 5, 6, 7, 6, 5],
[ 2, 1, 0, 1, 2, 3, 2, 1],
[ 6, 5, 4, 5, 6, 7, 6, 5],
[10, 9, 8, 9, 10, 11, 10, 9],
[14, 13, 12, 13, 14, 15, 14, 13],
[10, 9, 8, 9, 10, 11, 10, 9],
[ 6, 5, 4, 5, 6, 7, 6, 5]])
As you can see, the original array is in the center of the matrix, supplemented by two rows and two columns ( N//2 = 5//2 = 2both from the left / right, and the bottom / top). Padded items are reflected.
, :
>>> x = 1; y = 1
>>> B[y:y+N, x:x+N]
array([[ 5, 4, 5, 6, 7],
[ 1, 0, 1, 2, 3],
[ 5, 4, 5, 6, 7],
[ 9, 8, 9, 10, 11],
[13, 12, 13, 14, 15]])
, , .