The Maastricht Myocyte Toolkit, myokit for short, is a python-based software package designed to simplify the use of numerical models in the analysis of cardiac myocytes. Specifically, models that can be formulated as an ODE.

Myokit is being developed as part of my PhD Thesis at CARIM and DKE, two departments of Maastricht University. It is released as open source software under an LGPL license.

NOTE: Myokit is under active development. The currently available version is an alpha version, which means the interface may still change and some parts of the documentation are missing. While myokit has been tested succesfully on a number of platforms, it is not guaranteed to run on anything.

For more information, have a look at the documentation or send an email to Michael Clerx (michael@myokit.org).

Last update: May 2nd 2013

So what does it do?

Myokit provides a model definition syntax that allows you to write models without implementation details. The python API then runs the simulations directly in low-level C and returns the results to python for post-processing.

To do this, myokit takes advantage of python's distutils module to generate and compile C code for your models on the fly. With modern systems, this is a matter of milliseconds. As a backend, myokit uses the stiff-ode solver CVODE from the Sundials library, which is ideally suited for myocyte simulations.

Myokit can import models from CellML and export to C, matlab and python. By writing your own export modules you can set up experiments or analyses and re-use them for different models. Conversely, the separation of model code from engine allows you to run multiple types of analysis without having to rework your model.

Finally, a model editing GUI is provided as well as a growing number of analysis tools.

An example using the API

Myokit experiments are stored in an .mmt file containing

  1. A model definition, in myokit’s model definition syntax This contains all model equations, comments, units and the initial values of the state variables.
  2. A pacing protocol, in a syntax described here This can be either a periodic stimulus, for ordinary pacing, or a more complex protocol that mimicks path-clamp experiments.
  3. A plot script, in plain python In this part, you set up the simulation, run it and process the results.

In the example below, we’re going to ignore the plot script and use only the model and protocol:

import matplotlib.pyplot as pl
import myokit

# Load a model, protocol and plot script
m,p,x = myokit.load('example.mmt')

# Set 25% IK1 block
m.set_value('block.IK1', 0.25)

# Create a simulation
s = myokit.Simulation(m, p)

# Pre-pace for 99 beats
cl = 1000  # This should correspond to the cycle length of the protocol!
s.pre(99 * cl)

# Run the simulation for a single beat
d = s.run(1 * cl)

# Plot the results
pl.figure()
pl.title('Membrane potential')
pl.plot(d['engine.time'], d['membrane.V'])
pl.show()

An example using the GUI

The myokit GUI provides a tiny IDE for myokit models. The example below shows a model being edited in the GUI.

Using the "explorer" view you can browse the results of a simulation