Multi-model functions

The module myokit.lib.multi contains functions for working with multiple Myokit models.

myokit.lib.multi.binding(model, binding)

Deprecated alias of Model.bindingx().

myokit.lib.multi.iterdir(path, guarantee_model_names=True)

Iterates over a directory yielding tuples (model, protocol) where model is a myokit.Model and protocol is a myokit.Protocol.

Depending on the contents of the found files, some entries might not have a protocol. Files without a model are skipped.

The results will be yielded ordered by filename. The method does not descend into child directories.

If guarantee_model_names is True (default), models that do not specify a name meta-attribute will be given their filename as name. This ensures every model read by this method has a name meta-property.

myokit.lib.multi.label(model, label)

Deprecated alias of Model.labelx().


Scans a directory using iterdir() and returns a list of myokit.Model objects and a list of myokit.Protocol objects. The models (and corresponding protocols) will be ordered by model name.


Deprecated alias of Model.timex().

myokit.lib.multi.unit(variable, unit)

Checks if the given variable’s unit can be converted into units unit and, if so, returns the appropriate conversion factor. If not, a myokit.IncompatibleModelError is raised.


>>> import myokit
>>> import myokit.lib.multi as multi
>>> m,p,x = myokit.load('example')
>>> print(multi.unit(m.label('membrane_potential'), myokit.units.V))

(Because a millivolt can be converted to a volt by multiplying by 0.001)