Python¶
Full simulation export to Python is provided.
Limitations:
For running simulations, this method is incredibly slow.
API¶
The standard exporting API is provided:
- myokit.formats.python.exporters()¶
Returns a dict of all exporters available in this module.
- class myokit.formats.python.PythonExporter¶
This
Exportergenerates a python-only model implementation and a simple (but slow) integration routine.Both the model definition and the pacing protocol are fully exported.
Provides the following external variables:
timeThe current simulation time
paceThe current value of the pacing system, implemented using the given protocol.
A graph of the results is generated using matplotlib.
- myokit.formats.python.ewriters()¶
Returns a dict of all expression writers available in this module.
- class myokit.formats.python.PythonExpressionWriter¶
This
ExpressionWritertranslates Myokitexpressionsto their Python equivalent.- eq(q)¶
Converts a
myokit.Equationto a string.
- ex(e)¶
Converts a
myokit.Expressionto a string.
- set_lhs_function(f)¶
- Sets a naming function, will be called to get the variable name from a
myokit.LhsExpressionobject.
The argument
fshould be a function that takes anLhsExpressionas input and returns a string.
- class myokit.formats.python.NumPyExpressionWriter¶
This
ExpressionWritertranslates Myokitexpressionsto Python expressions intended for use in NumPy arrays.- eq(q)¶
Converts a
myokit.Equationto a string.
- ex(e)¶
Converts a
myokit.Expressionto a string.
- set_lhs_function(f)¶
- Sets a naming function, will be called to get the variable name from a
myokit.LhsExpressionobject.
The argument
fshould be a function that takes anLhsExpressionas input and returns a string.