Stan

Model export to Stan.

API

The standard exporting API is provided:

myokit.formats.stan.exporters()

Returns a dict of all exporters available in this module.

class myokit.formats.stan.StanExporter

This:class:Exporter <myokit.formats.Exporter> generates a Stan implementation of a Myokit model.

Only the model definition is exported. An interpolating pacing input method is added. No post-processing is included.

The following inputs are provided:

time

The current simulation time

pace

The current value of the pacing system, implemented using a very simple pacing mechanism.

runnable(path, model, protocol=None, parameters=None, output=None)

Exports a:class:myokit.Model to a Stan model with a parameter estimation file.

Arguments:

path

A string representing the directory to store the output in.

model

A Myokit model to export

protocol

Not implemented!

parameters

A list of variables or variable names, specifying the model variables to be estimated by stan.

output

A single variable to be used as the model output (for example an ion current).

myokit.formats.stan.ewriters()

Returns a dict of all expression writers available in this module.

class myokit.formats.stan.StanExpressionWriter

This:class:ExpressionWriter <myokit.formats.ExpressionWriter> translates Myokit:class:expressions <myokit.Expression> to a Stan syntax.

eq(q)

Converts a myokit.Equation to a string.

ex(e)

Converts a myokit.Expression to a string.

set_lhs_function(f)
Sets a naming function, will be called to get the variable name from a

myokit.LhsExpression object.

The argument f should be a function that takes an LhsExpression as input and returns a string.