put 2d coordinate axis at the center of an array in python

I am going to simulate a 2d area using a matrix in python and I should change the indexes somehow!. I need to find a relation between the original matrix and a new axis coordinate. I think it can be more clarified if I explain by a piece of my code:

originalMatrix=np.random.randint(0, 10, size=(5,5))

the output is:

[[4 8 3 2 5]
 [2 2 2 6 5]
 [2 4 7 9 9]
 [6 2 6 6 6]
 [2 8 3 8 2]]

we can access to number '7' by originalMatrix[2][2]. but in the coordinate system the index must be (0,0).Index of '4' in the left side of '7' in originalMatrix is [2][1] but in the new coordinate should be (-1,0) and so on... I hope I could explain well!


An easy way is to roll your array:

a = np.array([[4, 8, 3, 2, 5],
              [2, 2, 2, 6, 5],
              [2, 4, 7, 9, 9],
              [6, 2, 6, 6, 6],
              [2, 8, 3, 8, 2]])
center = np.array(a.shape)//2
# b will be indexed with the previous center being 0,0
b = np.roll(a, -center, axis=(0,1))

b[0, -1]
# 4

b[0, 0]
# 7

NB. You have to decide what is the center in case you have an even number as a dimension.