[Numpy-discussion] Cellular Automata Neighborhoods & Numpy

Michael Mersky me@mydis....
Sat Mar 19 21:35:52 CDT 2011

Hello, I stumbled upon this group tonight (
while searching Google for examples of Cellular Automata(CA) using Numpy.
The "Game of Life Strides" example looks great, but I don't fully comprehend
how this example is working:


If I have:

>>> world=arange(9).reshape(3,3)
>>> world
array([[0, 1, 2],
         [3, 4, 5],
         [6, 7, 8]])

how could I as_strided(world,shape?,strides) such that my 9 cell
neighborhood at [0][0]

would be something like this (i.e. wrapped):


Greatly appreciate your help!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110319/c3748531/attachment.html 

More information about the NumPy-Discussion mailing list