def wrappingNeighborhood(centerIndex, radius, dimensions):
centerPosition = coordinatesFromIndex(centerIndex, dimensions)<EOL>intervals = []<EOL>for i, dimension in enumerate(dimensions):<EOL><INDENT>left = centerPosition[i] - radius<EOL>right = min(centerPosition[i] + radius,<EOL>left + dimensions[i] - <NUM_LIT:1>)<EOL>interval = [v % dimension for v in xrange(left, right + <NUM_LIT:1>)]<EOL>intervals.append(interval)<EOL><DEDENT>coords = numpy.array(list(itertools.product(*intervals)))<EOL>return numpy.ravel_multi_index(coords.T, dimensions)<EOL>
Like :meth:`neighborhood`, except that the neighborhood isn't truncated when 
it's near an edge. It wraps around to the other side.

:param centerIndex: (int) The index of the point. The coordinates are 
       expressed as a single index by using the dimensions as a mixed radix 
       definition. For example, in dimensions 42x10, the point [1, 4] is index 
       1*420 + 4*10 = 460.

:param radius: (int) The radius of this neighborhood about the 
       ``centerIndex``.

:param dimensions: (indexable sequence) The dimensions of the world outside 
       this neighborhood.

:returns: (numpy array) The points in the neighborhood, including 
          ``centerIndex``.