Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CellularAutomata

pyCA is a Python library for building cellular automata and measuring the information their histories carry. It covers the elementary CAs (Wolfram rules 0–255), an Ising variant where a deterministic rule competes with a heat bath, noisy and asynchronous rule corruptions, and outer-totalistic 2d automata — Conway's Game of Life included — together with block entropy, entropy rate, and mutual information for the resulting spacetime diagrams.

The original MATLAB classes (2016) live on in matlab/.

Installation

git clone https://github.com/EternalTime/CellularAutomata.git
cd CellularAutomata
pip install -e .

Requires Python 3.8+; numpy and matplotlib are installed automatically.

Quick start

from pyCA import ECA, CA2D, measures

# rule 110 on a random lattice of 256 cells
ca = ECA(110, N=256)
ca.run(500)
print(measures.entropy_rate(ca.spacetime(), k=4))

# watch it live (close the window to stop)
ca.play()

# Conway's Game of Life
life = CA2D.life((128, 128))
life.run(200)
print(life.population)

The Ising and stochastic families follow the same pattern:

from pyCA import ICA, NoisyECA, AsyncECA

ica = ICA(110, temperature=1.5, stochfrac=0.3, N=256)
noisy = NoisyECA(90, noise=0.01, N=256)
lazy = AsyncECA(30, update_fraction=0.7, N=256)

Documentation

The documentation is hosted at damiansowinski.com/pyCA (or run import pyCA; pyCA.docs() to open it); the guides walk through each family and the information measures. To build locally: make -C docs html.

Tests

pip install pytest
pytest

License

MIT

About

A Python library for building cellular automata and measuring the information their histories carry. It covers the elementary CAs (Wolfram rules 0–255), an Ising variant where a deterministic rule competes with a heat bath, noisy and asynchronous rule corruptions, and outer-totalistic 2d automata, together with information theory measures.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages