I want to get the neighbors of the certain element in the numpy array. Lets consider following example
a = numpy.array([0,1,2,3,4,5,6,7,8,9])
Python takes care of boundaries for you:
>>> a = [0,1,2,3,4,5,6,7,8,9] >>> a[-100 : 1000] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> a[-100:3] [0, 1, 2]