Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.69 KB

README.md

File metadata and controls

54 lines (34 loc) · 1.69 KB

CAAF - Cellular Automaton Model of Atrial Fibrillation

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

An episode of atrial fibrillation in the model

Installation

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 .

Requirements

CAAF requires the following to run:

  • ffmpeg
  • numpy
  • matplotlib
  • numba

Quick start

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.

Usage

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)