Python implementation of the cellular automaton model of atrial fibrillation (CAAF) developed during my PhD. The model is described in the following paper:
Simple Model for Identifying Critical Regions in Atrial Fibrillation
K Christensen, KA Manani, NS Peters, PRL 2016
Git clone to a local directory:
git clone https://github.com/KishManani/CAAF.git
Change to CAAF directory and create a virtual enviornment. For example:
cd CAAF
pyenv virtualenv 3.7.1 caaf & pyenv local caaf
Install directly from the source code:
pip install -e .
CAAF requires the following to run:
- ffmpeg
- numpy
- matplotlib
- numba
A simulation can be run conveniently form the command line:
python main.py --num_iters 100 --plot 1
where the num_iters
parameter in the command line to set the number of iterations
the simulation should run for. Set the plot
parameter to 1 to record the simulation
as a .mp4 file in the figures subdirectory. A default set of model parameters are set in main.py.
The model has been implemented as a class called Heart. Heart objects contain: the structure of the CA lattice, methods to create the lattice, methods to run the simulation, and methods to stores the results of a simulation.
from CAAF import model
heart = model.Heart()
heart.update_grid(n_iters=100)
print(heart.num_active_cells)