myokit 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- myokit/__init__.py +5 -23
- myokit/__main__.py +70 -117
- myokit/_aux.py +5 -8
- myokit/_config.py +22 -31
- myokit/_datablock.py +26 -70
- myokit/_datalog.py +23 -53
- myokit/_err.py +13 -15
- myokit/_expressions.py +35 -55
- myokit/_io.py +5 -22
- myokit/_model_api.py +34 -47
- myokit/_myokit_version.py +1 -5
- myokit/_parsing.py +17 -25
- myokit/_progress.py +4 -7
- myokit/_protocol.py +6 -9
- myokit/_sim/__init__.py +7 -24
- myokit/_sim/cable.c +1 -3
- myokit/_sim/cable.py +3 -5
- myokit/_sim/cmodel.h +1 -3
- myokit/_sim/cmodel.py +1 -4
- myokit/_sim/compiler.py +1 -4
- myokit/_sim/cvodessim.c +1 -4
- myokit/_sim/cvodessim.py +1 -4
- myokit/_sim/fiber_tissue.c +2 -6
- myokit/_sim/fiber_tissue.py +3 -5
- myokit/_sim/jacobian.py +6 -7
- myokit/_sim/mcl.h +51 -53
- myokit/_sim/opencl.py +9 -22
- myokit/_sim/openclsim.c +2 -6
- myokit/_sim/openclsim.py +6 -6
- myokit/_sim/pacing.h +2 -6
- myokit/_sim/rhs.c +3 -10
- myokit/_sim/rhs.py +4 -13
- myokit/_sim/sundials.py +1 -4
- myokit/_system.py +10 -16
- myokit/_unit.py +3 -12
- myokit/float.py +0 -3
- myokit/formats/__init__.py +8 -10
- myokit/formats/ansic/__init__.py +0 -3
- myokit/formats/ansic/_ewriter.py +2 -4
- myokit/formats/ansic/_exporter.py +0 -3
- myokit/formats/axon/__init__.py +1 -3
- myokit/formats/axon/_abf.py +12 -15
- myokit/formats/axon/_atf.py +5 -6
- myokit/formats/axon/_importer.py +0 -3
- myokit/formats/cellml/__init__.py +0 -3
- myokit/formats/cellml/_ewriter.py +3 -6
- myokit/formats/cellml/_exporter.py +3 -6
- myokit/formats/cellml/_importer.py +1 -4
- myokit/formats/cellml/v1/__init__.py +0 -4
- myokit/formats/cellml/v1/_api.py +7 -10
- myokit/formats/cellml/v1/_parser.py +2 -5
- myokit/formats/cellml/v1/_writer.py +2 -11
- myokit/formats/cellml/v2/__init__.py +0 -3
- myokit/formats/cellml/v2/_api.py +7 -16
- myokit/formats/cellml/v2/_parser.py +2 -5
- myokit/formats/cellml/v2/_writer.py +1 -4
- myokit/formats/channelml/__init__.py +0 -3
- myokit/formats/channelml/_importer.py +4 -14
- myokit/formats/cpp/__init__.py +1 -3
- myokit/formats/cpp/_ewriter.py +0 -3
- myokit/formats/cuda/__init__.py +0 -3
- myokit/formats/cuda/_ewriter.py +2 -4
- myokit/formats/cuda/_exporter.py +0 -3
- myokit/formats/easyml/__init__.py +0 -3
- myokit/formats/easyml/_ewriter.py +9 -11
- myokit/formats/easyml/_exporter.py +0 -3
- myokit/formats/html/__init__.py +0 -3
- myokit/formats/html/_exporter.py +0 -3
- myokit/formats/html/_flatten.py +5 -21
- myokit/formats/latex/__init__.py +0 -3
- myokit/formats/latex/_ewriter.py +1 -4
- myokit/formats/latex/_exporter.py +3 -5
- myokit/formats/mathml/__init__.py +0 -3
- myokit/formats/mathml/_ewriter.py +2 -11
- myokit/formats/mathml/_parser.py +3 -5
- myokit/formats/matlab/__init__.py +0 -3
- myokit/formats/matlab/_ewriter.py +1 -4
- myokit/formats/matlab/_exporter.py +0 -3
- myokit/formats/opencl/__init__.py +0 -3
- myokit/formats/opencl/_ewriter.py +2 -4
- myokit/formats/opencl/_exporter.py +0 -3
- myokit/formats/python/__init__.py +0 -3
- myokit/formats/python/_ewriter.py +2 -5
- myokit/formats/python/_exporter.py +0 -3
- myokit/formats/python/template/sim.py +10 -10
- myokit/formats/sbml/__init__.py +0 -3
- myokit/formats/sbml/_api.py +17 -11
- myokit/formats/sbml/_importer.py +1 -4
- myokit/formats/sbml/_parser.py +2 -5
- myokit/formats/stan/__init__.py +0 -3
- myokit/formats/stan/_ewriter.py +2 -4
- myokit/formats/stan/_exporter.py +1 -4
- myokit/formats/sympy/__init__.py +0 -3
- myokit/formats/sympy/_ereader.py +1 -4
- myokit/formats/sympy/_ewriter.py +2 -5
- myokit/formats/wcp/__init__.py +0 -3
- myokit/formats/wcp/_wcp.py +1 -7
- myokit/formats/xml/__init__.py +0 -3
- myokit/formats/xml/_exporter.py +0 -3
- myokit/formats/xml/_split.py +0 -3
- myokit/gui/__init__.py +75 -247
- myokit/gui/datablock_viewer.py +100 -83
- myokit/gui/datalog_viewer.py +32 -44
- myokit/gui/explorer.py +15 -21
- myokit/gui/ide.py +105 -125
- myokit/gui/progress.py +9 -9
- myokit/gui/source.py +405 -374
- myokit/gui/vargrapher.py +2 -12
- myokit/lib/deps.py +7 -8
- myokit/lib/guess.py +1 -2
- myokit/lib/hh.py +5 -7
- myokit/lib/markov.py +9 -11
- myokit/lib/multi.py +1 -3
- myokit/lib/plots.py +1 -3
- myokit/pacing.py +0 -3
- myokit/pype.py +7 -18
- myokit/tests/__init__.py +3 -6
- myokit/tests/ansic_event_based_pacing.py +1 -4
- myokit/tests/ansic_fixed_form_pacing.py +1 -4
- myokit/tests/test_aux.py +9 -23
- myokit/tests/test_cellml_v1_api.py +1 -16
- myokit/tests/test_cellml_v1_parser.py +0 -15
- myokit/tests/test_cellml_v1_writer.py +0 -9
- myokit/tests/test_cellml_v2_api.py +1 -16
- myokit/tests/test_cellml_v2_parser.py +0 -15
- myokit/tests/test_cellml_v2_writer.py +0 -9
- myokit/tests/test_cmodel.py +0 -9
- myokit/tests/test_compiler_detection.py +1 -11
- myokit/tests/test_component.py +0 -10
- myokit/tests/test_config.py +33 -66
- myokit/tests/test_datablock.py +1 -9
- myokit/tests/test_datalog.py +4 -21
- myokit/tests/test_dependency_checking.py +8 -23
- myokit/tests/test_expressions.py +0 -9
- myokit/tests/test_float.py +1 -5
- myokit/tests/test_formats.py +0 -9
- myokit/tests/test_formats_axon.py +1 -9
- myokit/tests/test_formats_cellml.py +0 -15
- myokit/tests/test_formats_channelml.py +0 -15
- myokit/tests/test_formats_easyml.py +0 -14
- myokit/tests/test_formats_exporters.py +1 -16
- myokit/tests/test_formats_expression_writers.py +1 -17
- myokit/tests/test_formats_html.py +0 -3
- myokit/tests/test_formats_importers.py +1 -16
- myokit/tests/test_formats_mathml_content.py +0 -9
- myokit/tests/test_formats_mathml_presentation.py +0 -9
- myokit/tests/test_formats_opencl.py +0 -10
- myokit/tests/test_formats_sbml.py +0 -15
- myokit/tests/test_formats_sympy.py +0 -9
- myokit/tests/test_formats_wcp.py +1 -3
- myokit/tests/test_io.py +6 -14
- myokit/tests/test_jacobian_calculator.py +1 -9
- myokit/tests/test_jacobian_tracer.py +0 -9
- myokit/tests/test_lib_deps.py +0 -9
- myokit/tests/test_lib_guess.py +0 -9
- myokit/tests/test_lib_hh.py +1 -9
- myokit/tests/test_lib_markov.py +1 -9
- myokit/tests/test_lib_multi.py +0 -9
- myokit/tests/test_lib_plots.py +0 -3
- myokit/tests/test_meta.py +0 -3
- myokit/tests/test_model.py +0 -10
- myokit/tests/test_model_building.py +2 -17
- myokit/tests/test_opencl_info.py +5 -14
- myokit/tests/test_pacing_factory.py +0 -3
- myokit/tests/test_pacing_system_c.py +0 -9
- myokit/tests/test_pacing_system_py.py +0 -9
- myokit/tests/test_parsing.py +5 -20
- myokit/tests/test_progress_reporters.py +0 -3
- myokit/tests/test_protocol.py +0 -9
- myokit/tests/test_protocol_floating_point.py +0 -9
- myokit/tests/test_protocol_time_series.py +0 -10
- myokit/tests/test_pype.py +0 -9
- myokit/tests/test_quantity.py +0 -9
- myokit/tests/test_rhs_benchmarker.py +1 -9
- myokit/tests/test_sbml_api.py +0 -15
- myokit/tests/test_sbml_parser.py +0 -15
- myokit/tests/test_simulation_1d.py +1 -10
- myokit/tests/test_simulation_cvodes.py +8 -16
- myokit/tests/test_simulation_cvodes_from_disk.py +0 -3
- myokit/tests/test_simulation_fiber_tissue.py +1 -10
- myokit/tests/test_simulation_log_interval.py +0 -9
- myokit/tests/test_simulation_opencl.py +1 -10
- myokit/tests/test_simulation_opencl_log_interval.py +1 -3
- myokit/tests/test_simulation_opencl_vs_cvode.py +1 -10
- myokit/tests/test_simulation_opencl_vs_sim1d.py +1 -10
- myokit/tests/test_system_info.py +1 -11
- myokit/tests/test_tools.py +0 -9
- myokit/tests/test_unit.py +0 -9
- myokit/tests/test_user_functions.py +0 -10
- myokit/tests/test_variable.py +0 -10
- myokit/tools.py +5 -21
- myokit/units.py +0 -3
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/METADATA +7 -7
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/RECORD +198 -200
- myokit/_exec_new.py +0 -15
- myokit/_exec_old.py +0 -15
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/LICENSE.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/WHEEL +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/entry_points.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/top_level.txt +0 -0
myokit/formats/cuda/_exporter.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import EasyMLExporter
|
|
11
8
|
from ._ewriter import EasyMLExpressionWriter
|
|
12
9
|
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import warnings
|
|
11
8
|
|
|
12
9
|
import myokit
|
|
10
|
+
|
|
13
11
|
from myokit.formats.python import PythonExpressionWriter
|
|
14
12
|
|
|
15
13
|
|
|
@@ -19,7 +17,7 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
|
|
|
19
17
|
equations for variables in EasyML syntax.
|
|
20
18
|
"""
|
|
21
19
|
def __init__(self):
|
|
22
|
-
super(
|
|
20
|
+
super().__init__()
|
|
23
21
|
self._function_prefix = ''
|
|
24
22
|
|
|
25
23
|
#def _ex_name(self, e):
|
|
@@ -39,7 +37,7 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
|
|
|
39
37
|
if isinstance(e[1], myokit.Exp) and isinstance(e[0], myokit.Number):
|
|
40
38
|
if e[0].eval() == 1:
|
|
41
39
|
return '-expm1(' + self.ex(e[1][0]) + ')'
|
|
42
|
-
return super(
|
|
40
|
+
return super()._ex_minus(e)
|
|
43
41
|
|
|
44
42
|
#def _ex_multiply(self, e):
|
|
45
43
|
#def _ex_divide(self, e):
|
|
@@ -58,23 +56,23 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
|
|
|
58
56
|
|
|
59
57
|
def _ex_sin(self, e):
|
|
60
58
|
warnings.warn('Potentially unsupported function: sin()')
|
|
61
|
-
return super(
|
|
59
|
+
return super()._ex_sin(e)
|
|
62
60
|
|
|
63
61
|
#def _ex_cos(self, e):
|
|
64
62
|
|
|
65
63
|
def _ex_tan(self, e):
|
|
66
64
|
warnings.warn('Potentially unsupported function: tan()')
|
|
67
|
-
return super(
|
|
65
|
+
return super()._ex_tan(e)
|
|
68
66
|
|
|
69
67
|
def _ex_asin(self, e):
|
|
70
68
|
warnings.warn('Potentially unsupported function: asin()')
|
|
71
|
-
return super(
|
|
69
|
+
return super()._ex_asin(e)
|
|
72
70
|
|
|
73
71
|
#def _ex_acos(self, e):
|
|
74
72
|
|
|
75
73
|
def _ex_atan(self, e):
|
|
76
74
|
warnings.warn('Potentially unsupported function: atan()')
|
|
77
|
-
return super(
|
|
75
|
+
return super()._ex_atan(e)
|
|
78
76
|
|
|
79
77
|
#def _ex_exp(self, e):
|
|
80
78
|
|
|
@@ -87,11 +85,11 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
|
|
|
87
85
|
|
|
88
86
|
def _ex_floor(self, e):
|
|
89
87
|
warnings.warn('Potentially unsupported function: floor()')
|
|
90
|
-
return super(
|
|
88
|
+
return super()._ex_floor(e)
|
|
91
89
|
|
|
92
90
|
def _ex_ceil(self, e):
|
|
93
91
|
warnings.warn('Potentially unsupported function: ceil()')
|
|
94
|
-
return super(
|
|
92
|
+
return super()._ex_ceil(e)
|
|
95
93
|
|
|
96
94
|
def _ex_abs(self, e):
|
|
97
95
|
return self._ex_function(e, 'fabs')
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import collections
|
|
11
8
|
import os
|
|
12
9
|
import warnings
|
myokit/formats/html/__init__.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import HTMLExporter
|
|
11
8
|
from ._flatten import html2ascii # noqa
|
|
12
9
|
|
myokit/formats/html/_exporter.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from lxml import etree
|
|
11
8
|
|
|
12
9
|
import myokit
|
myokit/formats/html/_flatten.py
CHANGED
|
@@ -4,19 +4,11 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import html
|
|
8
|
+
import html.parser
|
|
10
9
|
import re
|
|
11
|
-
import sys
|
|
12
10
|
import textwrap
|
|
13
11
|
|
|
14
|
-
# HTML Parser in Python 2 and 3
|
|
15
|
-
try:
|
|
16
|
-
from HTMLParser import HTMLParser
|
|
17
|
-
except ImportError:
|
|
18
|
-
from html.parser import HTMLParser
|
|
19
|
-
|
|
20
12
|
|
|
21
13
|
def html2ascii(html, width=79, indent=' '):
|
|
22
14
|
"""
|
|
@@ -32,21 +24,13 @@ def html2ascii(html, width=79, indent=' '):
|
|
|
32
24
|
return f.get_text()
|
|
33
25
|
|
|
34
26
|
|
|
35
|
-
class Asciifier(HTMLParser):
|
|
27
|
+
class Asciifier(html.parser.HTMLParser):
|
|
36
28
|
INDENT = 1
|
|
37
29
|
DEDENT = -1
|
|
38
30
|
WHITE = [' ', '\t', '\f', '\r', '\n']
|
|
39
31
|
|
|
40
32
|
def __init__(self, line_width=79, indent=' '):
|
|
41
|
-
|
|
42
|
-
# HTMLParser requires old-school constructor
|
|
43
|
-
HTMLParser.__init__(self)
|
|
44
|
-
else: # pragma: no python 2 cover
|
|
45
|
-
super(Asciifier, self).__init__(convert_charrefs=False)
|
|
46
|
-
|
|
47
|
-
# Unescape method is deprecated
|
|
48
|
-
import html
|
|
49
|
-
self.unescape = html.unescape
|
|
33
|
+
super().__init__(convert_charrefs=False)
|
|
50
34
|
|
|
51
35
|
# In <head> yes/no
|
|
52
36
|
self.inhead = False
|
|
@@ -226,7 +210,7 @@ class Asciifier(HTMLParser):
|
|
|
226
210
|
return
|
|
227
211
|
|
|
228
212
|
# Convert html characters
|
|
229
|
-
data =
|
|
213
|
+
data = html.unescape('&' + name + ';')
|
|
230
214
|
|
|
231
215
|
# Convert to ascii and back to strip out non-ascii content
|
|
232
216
|
data = data.encode('ascii', 'ignore').decode('ascii')
|
myokit/formats/latex/__init__.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import PdfExporter, PosterExporter
|
|
11
8
|
from ._ewriter import LatexExpressionWriter
|
|
12
9
|
|
myokit/formats/latex/_ewriter.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import myokit.formats
|
|
11
8
|
|
|
12
9
|
|
|
@@ -16,7 +13,7 @@ class LatexExpressionWriter(myokit.formats.ExpressionWriter):
|
|
|
16
13
|
Myokit :class:`expressions <myokit.Expression>` to their Tex equivalent.
|
|
17
14
|
"""
|
|
18
15
|
def __init__(self):
|
|
19
|
-
super(
|
|
16
|
+
super().__init__()
|
|
20
17
|
|
|
21
18
|
# Default time variable
|
|
22
19
|
self._time = None
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import os
|
|
11
8
|
|
|
12
9
|
import myokit
|
|
10
|
+
|
|
13
11
|
from ._ewriter import LatexExpressionWriter
|
|
14
12
|
|
|
15
13
|
|
|
@@ -19,7 +17,7 @@ class PdfExporter(myokit.formats.Exporter):
|
|
|
19
17
|
a simple latex document.
|
|
20
18
|
"""
|
|
21
19
|
def __init__(self):
|
|
22
|
-
super(
|
|
20
|
+
super().__init__()
|
|
23
21
|
|
|
24
22
|
def _clean(self, text):
|
|
25
23
|
"""
|
|
@@ -111,7 +109,7 @@ class PosterExporter(myokit.formats.Exporter):
|
|
|
111
109
|
beholders.
|
|
112
110
|
"""
|
|
113
111
|
def __init__(self):
|
|
114
|
-
super(
|
|
112
|
+
super().__init__()
|
|
115
113
|
|
|
116
114
|
def post_export_info(self):
|
|
117
115
|
return '\n'.join((
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._ewriter import MathMLExpressionWriter
|
|
11
8
|
from ._parser import ( # noqa
|
|
12
9
|
MathMLError,
|
|
@@ -4,19 +4,10 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from lxml import etree
|
|
11
8
|
|
|
12
9
|
import myokit.formats
|
|
13
10
|
|
|
14
|
-
# Strings in Python 2 and 3
|
|
15
|
-
try:
|
|
16
|
-
basestring
|
|
17
|
-
except NameError: # pragma: no cover
|
|
18
|
-
basestring = str
|
|
19
|
-
|
|
20
11
|
|
|
21
12
|
class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
|
|
22
13
|
"""
|
|
@@ -25,7 +16,7 @@ class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
|
|
|
25
16
|
Presentation MathML.
|
|
26
17
|
"""
|
|
27
18
|
def __init__(self):
|
|
28
|
-
super(
|
|
19
|
+
super().__init__()
|
|
29
20
|
|
|
30
21
|
# Default mode
|
|
31
22
|
self._pres = False
|
|
@@ -33,7 +24,7 @@ class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
|
|
|
33
24
|
# Default lhs conversion function
|
|
34
25
|
def flhs(lhs):
|
|
35
26
|
var = lhs.var()
|
|
36
|
-
if isinstance(var,
|
|
27
|
+
if isinstance(var, str):
|
|
37
28
|
# This can happen with time variable of derivative if the
|
|
38
29
|
# proper variable isn't set!
|
|
39
30
|
return var
|
myokit/formats/mathml/_parser.py
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import myokit
|
|
8
|
+
|
|
11
9
|
from myokit.formats.xml import split
|
|
12
10
|
|
|
13
11
|
|
|
@@ -63,10 +61,10 @@ class MathMLError(myokit.ImportError):
|
|
|
63
61
|
message = 'Error on line ' + line + '. ' + message
|
|
64
62
|
except AttributeError:
|
|
65
63
|
pass
|
|
66
|
-
super(
|
|
64
|
+
super().__init__(message)
|
|
67
65
|
|
|
68
66
|
|
|
69
|
-
class MathMLParser
|
|
67
|
+
class MathMLParser:
|
|
70
68
|
"""
|
|
71
69
|
Parses MathML expressions into :class:`myokit.Expression` objects.
|
|
72
70
|
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import MatlabExporter
|
|
11
8
|
from ._ewriter import MatlabExpressionWriter
|
|
12
9
|
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from myokit.formats.python import PythonExpressionWriter
|
|
11
8
|
|
|
12
9
|
|
|
@@ -16,7 +13,7 @@ class MatlabExpressionWriter(PythonExpressionWriter):
|
|
|
16
13
|
Myokit :class:`expressions <myokit.Expression>` to a Matlab syntax.
|
|
17
14
|
"""
|
|
18
15
|
def __init__(self):
|
|
19
|
-
super(
|
|
16
|
+
super().__init__()
|
|
20
17
|
self._function_prefix = ''
|
|
21
18
|
self._fcond = 'ifthenelse'
|
|
22
19
|
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import OpenCLExporter, OpenCLRLExporter
|
|
11
8
|
from ._ewriter import OpenCLExpressionWriter
|
|
12
9
|
from myokit.formats import ansic
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import myokit
|
|
8
|
+
|
|
11
9
|
from myokit.formats.python import PythonExpressionWriter
|
|
12
10
|
|
|
13
11
|
|
|
@@ -17,7 +15,7 @@ class OpenCLExpressionWriter(PythonExpressionWriter):
|
|
|
17
15
|
Myokit :class:`expressions <myokit.Expression>` to OpenCL syntax.
|
|
18
16
|
"""
|
|
19
17
|
def __init__(self, precision=myokit.SINGLE_PRECISION, native_math=True):
|
|
20
|
-
super(
|
|
18
|
+
super().__init__()
|
|
21
19
|
self._function_prefix = ''
|
|
22
20
|
self._sp = (precision == myokit.SINGLE_PRECISION)
|
|
23
21
|
self._nm = bool(native_math)
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._exporter import PythonExporter
|
|
11
8
|
from ._ewriter import PythonExpressionWriter, NumPyExpressionWriter
|
|
12
9
|
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import myokit.formats
|
|
11
8
|
|
|
12
9
|
|
|
@@ -17,7 +14,7 @@ class PythonExpressionWriter(myokit.formats.ExpressionWriter):
|
|
|
17
14
|
equivalent.
|
|
18
15
|
"""
|
|
19
16
|
def __init__(self):
|
|
20
|
-
super(
|
|
17
|
+
super().__init__()
|
|
21
18
|
|
|
22
19
|
self._flhs = None
|
|
23
20
|
self.set_lhs_function(lambda v: str(v))
|
|
@@ -192,7 +189,7 @@ class NumPyExpressionWriter(PythonExpressionWriter):
|
|
|
192
189
|
intended for use in NumPy arrays.
|
|
193
190
|
"""
|
|
194
191
|
def __init__(self):
|
|
195
|
-
super(
|
|
192
|
+
super().__init__()
|
|
196
193
|
self._function_prefix = 'numpy.'
|
|
197
194
|
#def _ex_name(self, e):
|
|
198
195
|
#def _ex_derivative(self, e):
|
|
@@ -73,7 +73,7 @@ for comp in components:
|
|
|
73
73
|
w.set_lhs_function(lambda x: v(x, comp))
|
|
74
74
|
|
|
75
75
|
?>
|
|
76
|
-
class <?= names[1]
|
|
76
|
+
class <?= names[1] ?>:
|
|
77
77
|
def __init__(self):
|
|
78
78
|
<?
|
|
79
79
|
for var in comp.variables(deep=True):
|
|
@@ -118,7 +118,7 @@ class <?= names[1] ?>(object):
|
|
|
118
118
|
#
|
|
119
119
|
# Engine component
|
|
120
120
|
#
|
|
121
|
-
class Engine
|
|
121
|
+
class Engine:
|
|
122
122
|
"""
|
|
123
123
|
Calculates the derivatives in the current state
|
|
124
124
|
"""
|
|
@@ -213,10 +213,10 @@ def test_step():
|
|
|
213
213
|
#
|
|
214
214
|
# Pacing
|
|
215
215
|
#
|
|
216
|
-
class Protocol
|
|
216
|
+
class Protocol:
|
|
217
217
|
""" Holds an ordered set of ProtocolEvent objects """
|
|
218
218
|
def __init__(self):
|
|
219
|
-
super(
|
|
219
|
+
super().__init__()
|
|
220
220
|
self.head = None
|
|
221
221
|
def add(self, e):
|
|
222
222
|
""" Schedules an event """
|
|
@@ -238,9 +238,11 @@ class Protocol(object):
|
|
|
238
238
|
if self.head is not None:
|
|
239
239
|
self.head = self.head.next
|
|
240
240
|
return e
|
|
241
|
-
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ProtocolEvent:
|
|
242
244
|
def __init__(self, level, start, duration, period=0, multiplier=0):
|
|
243
|
-
super(
|
|
245
|
+
super().__init__()
|
|
244
246
|
self.level = float(level)
|
|
245
247
|
self.start = float(start)
|
|
246
248
|
self.duration = float(duration)
|
|
@@ -256,6 +258,7 @@ class ProtocolEvent(object):
|
|
|
256
258
|
raise Exception('Non-periodic event cannot occur more than once')
|
|
257
259
|
self.next = None
|
|
258
260
|
|
|
261
|
+
|
|
259
262
|
def pacing_protocol():
|
|
260
263
|
pacing = Protocol()
|
|
261
264
|
<?
|
|
@@ -377,10 +380,7 @@ if __name__ == '__main__':
|
|
|
377
380
|
except ArithmeticError as e:
|
|
378
381
|
print('Arithmetic error occurred')
|
|
379
382
|
y = 'Continue with smaller stepsize? (y/n): '
|
|
380
|
-
|
|
381
|
-
y = raw_input(y) # Python 2
|
|
382
|
-
except NameError:
|
|
383
|
-
y = input(y) # Python 3
|
|
383
|
+
y = input(y)
|
|
384
384
|
if y.lower()[0:1] == 'y':
|
|
385
385
|
small /= 2
|
|
386
386
|
large /= 2
|
myokit/formats/sbml/__init__.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._api import ( # noqa
|
|
11
8
|
Compartment,
|
|
12
9
|
CSymbolVariable,
|
myokit/formats/sbml/_api.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
#
|
|
2
|
+
# SBML API
|
|
3
|
+
#
|
|
4
|
+
# This file is part of Myokit.
|
|
5
|
+
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
|
+
#
|
|
1
7
|
import collections
|
|
2
8
|
import warnings
|
|
3
9
|
import re
|
|
@@ -16,7 +22,7 @@ class SBMLError(Exception):
|
|
|
16
22
|
"""Raised if something goes wrong when working with an SBML model."""
|
|
17
23
|
|
|
18
24
|
|
|
19
|
-
class Quantity
|
|
25
|
+
class Quantity:
|
|
20
26
|
"""
|
|
21
27
|
Base class for anything that has a numerical value in an SBML model, and
|
|
22
28
|
can be set by rules, reactions, or initial assignments.
|
|
@@ -89,7 +95,7 @@ class Quantity(object):
|
|
|
89
95
|
return self._value
|
|
90
96
|
|
|
91
97
|
|
|
92
|
-
class CSymbolVariable
|
|
98
|
+
class CSymbolVariable:
|
|
93
99
|
"""
|
|
94
100
|
Represents a CSymbol that can appear in SBML expressions, but which has a
|
|
95
101
|
predetermind value and/or meaning, e.g. "time".
|
|
@@ -122,7 +128,7 @@ class Compartment(Quantity):
|
|
|
122
128
|
|
|
123
129
|
"""
|
|
124
130
|
def __init__(self, model, sid):
|
|
125
|
-
super(
|
|
131
|
+
super().__init__()
|
|
126
132
|
|
|
127
133
|
if not isinstance(model, Model):
|
|
128
134
|
raise SBMLError(
|
|
@@ -185,7 +191,7 @@ class Compartment(Quantity):
|
|
|
185
191
|
return '<Compartment ' + self._sid + '>'
|
|
186
192
|
|
|
187
193
|
|
|
188
|
-
class Model
|
|
194
|
+
class Model:
|
|
189
195
|
"""
|
|
190
196
|
Represents a model in SBML.
|
|
191
197
|
|
|
@@ -581,7 +587,7 @@ class Parameter(Quantity):
|
|
|
581
587
|
|
|
582
588
|
"""
|
|
583
589
|
def __init__(self, model, sid):
|
|
584
|
-
super(
|
|
590
|
+
super().__init__()
|
|
585
591
|
|
|
586
592
|
if not isinstance(model, Model):
|
|
587
593
|
raise SBMLError(
|
|
@@ -612,7 +618,7 @@ class Parameter(Quantity):
|
|
|
612
618
|
return self._units
|
|
613
619
|
|
|
614
620
|
|
|
615
|
-
class Reaction
|
|
621
|
+
class Reaction:
|
|
616
622
|
"""
|
|
617
623
|
Represents an SBML reaction; to create a reaction use
|
|
618
624
|
:meth:`Model.add_reaction()`.
|
|
@@ -772,7 +778,7 @@ class Species(Quantity):
|
|
|
772
778
|
|
|
773
779
|
"""
|
|
774
780
|
def __init__(self, compartment, sid, is_amount, is_constant, is_boundary):
|
|
775
|
-
super(
|
|
781
|
+
super().__init__()
|
|
776
782
|
|
|
777
783
|
if not isinstance(compartment, Compartment):
|
|
778
784
|
raise SBMLError(
|
|
@@ -914,7 +920,7 @@ class SpeciesReference(Quantity):
|
|
|
914
920
|
MODIFIER = 2
|
|
915
921
|
|
|
916
922
|
def __init__(self, species, sid=None):
|
|
917
|
-
super(
|
|
923
|
+
super().__init__()
|
|
918
924
|
|
|
919
925
|
if not isinstance(species, Species):
|
|
920
926
|
raise SBMLError(
|
|
@@ -936,11 +942,11 @@ class SpeciesReference(Quantity):
|
|
|
936
942
|
return '<SpeciesReference ' + self._sid + '>'
|
|
937
943
|
|
|
938
944
|
|
|
939
|
-
class ModifierSpeciesReference
|
|
945
|
+
class ModifierSpeciesReference:
|
|
940
946
|
"""Represents a reference to a modifier species in an SBML reaction."""
|
|
941
947
|
|
|
942
948
|
def __init__(self, species, sid=None):
|
|
943
|
-
super(
|
|
949
|
+
super().__init__()
|
|
944
950
|
|
|
945
951
|
if not isinstance(species, Species):
|
|
946
952
|
raise SBMLError(
|
|
@@ -971,7 +977,7 @@ def convert_name(name):
|
|
|
971
977
|
return name
|
|
972
978
|
|
|
973
979
|
|
|
974
|
-
class _MyokitConverter
|
|
980
|
+
class _MyokitConverter:
|
|
975
981
|
"""
|
|
976
982
|
Converts SBML Models to Myokit models.
|
|
977
983
|
"""
|
myokit/formats/sbml/_importer.py
CHANGED
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
# This file is part of Myokit.
|
|
8
8
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
9
9
|
#
|
|
10
|
-
from __future__ import absolute_import, division
|
|
11
|
-
from __future__ import print_function, unicode_literals
|
|
12
|
-
|
|
13
10
|
import myokit.formats
|
|
14
11
|
|
|
15
12
|
|
|
@@ -22,7 +19,7 @@ class SBMLImporter(myokit.formats.Importer):
|
|
|
22
19
|
:class:`myokit.formats.sbml.SBMLParser`.
|
|
23
20
|
"""
|
|
24
21
|
def __init__(self):
|
|
25
|
-
super(
|
|
22
|
+
super().__init__()
|
|
26
23
|
|
|
27
24
|
def supports_model(self):
|
|
28
25
|
"""Returns ``True``."""
|
myokit/formats/sbml/_parser.py
CHANGED
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
# This file is part of Myokit.
|
|
9
9
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
10
10
|
#
|
|
11
|
-
from __future__ import absolute_import, division
|
|
12
|
-
from __future__ import print_function, unicode_literals
|
|
13
|
-
|
|
14
11
|
import re
|
|
15
12
|
import warnings
|
|
16
13
|
|
|
@@ -76,10 +73,10 @@ class SBMLParsingError(myokit.ImportError):
|
|
|
76
73
|
message = 'Error on line ' + line + '. ' + message
|
|
77
74
|
except AttributeError: # pragma: no cover
|
|
78
75
|
pass
|
|
79
|
-
super(
|
|
76
|
+
super().__init__(message)
|
|
80
77
|
|
|
81
78
|
|
|
82
|
-
class SBMLParser
|
|
79
|
+
class SBMLParser:
|
|
83
80
|
"""
|
|
84
81
|
Parses SBML models, creating an SBML Model structure that can be converted
|
|
85
82
|
to a :class:`myokit.Model` object.
|