[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 (
http://mail.scipy.org/pipermail/numpy-discussion/2010-October/053420.html)
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:

http://scipy.org/Cookbook/GameOfLifeStrides

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):

array([[8,6,7],
         [2,0,1],
         [5,3,4]])

Greatly appreciate your help!

-m
-------------- 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