myokit 1.33.9__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 +9 -36
- myokit/__main__.py +76 -142
- myokit/_aux.py +62 -16
- myokit/_bin/example.mmt +1 -2
- myokit/_bin/install-win/menu.json +7 -7
- myokit/_config.py +22 -31
- myokit/_datablock.py +30 -74
- myokit/_datalog.py +49 -72
- myokit/_err.py +25 -24
- myokit/_expressions.py +50 -68
- myokit/_io.py +15 -27
- myokit/_model_api.py +453 -249
- myokit/_myokit_version.py +1 -5
- myokit/_parsing.py +38 -44
- myokit/_progress.py +5 -8
- myokit/_protocol.py +99 -9
- myokit/_sim/__init__.py +7 -24
- myokit/_sim/cable.c +6 -8
- myokit/_sim/cable.py +6 -8
- myokit/_sim/cmodel.h +125 -70
- myokit/_sim/cmodel.py +12 -14
- myokit/_sim/compiler.py +1 -4
- myokit/_sim/cvodessim.c +196 -118
- myokit/_sim/cvodessim.py +130 -103
- myokit/_sim/differential.hpp +4 -4
- myokit/_sim/fiber_tissue.c +4 -8
- myokit/_sim/fiber_tissue.py +11 -13
- myokit/_sim/jacobian.cpp +2 -2
- myokit/_sim/jacobian.py +11 -8
- myokit/_sim/mcl.h +53 -55
- myokit/_sim/opencl.py +21 -27
- myokit/_sim/openclsim.c +3 -7
- myokit/_sim/openclsim.cl +3 -3
- myokit/_sim/openclsim.py +49 -40
- myokit/_sim/pacing.h +36 -16
- myokit/_sim/rhs.c +6 -13
- myokit/_sim/rhs.py +5 -14
- myokit/_sim/sundials.py +1 -4
- myokit/_system.py +10 -16
- myokit/_unit.py +4 -13
- 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 +1 -4
- myokit/formats/ansic/template/cable.c +4 -4
- myokit/formats/ansic/template/euler.c +5 -5
- myokit/formats/ansic/template/sim.c +6 -6
- myokit/formats/axon/__init__.py +1 -3
- myokit/formats/axon/_abf.py +12 -17
- 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 +8 -11
- 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 +8 -17
- 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 +11 -21
- 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/cuda/template/kernel.cu +8 -5
- myokit/formats/easyml/__init__.py +0 -3
- myokit/formats/easyml/_ewriter.py +9 -11
- myokit/formats/easyml/_exporter.py +2 -5
- 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 +4 -6
- myokit/formats/mathml/__init__.py +0 -3
- myokit/formats/mathml/_ewriter.py +2 -11
- myokit/formats/mathml/_parser.py +4 -6
- myokit/formats/matlab/__init__.py +0 -3
- myokit/formats/matlab/_ewriter.py +1 -4
- myokit/formats/matlab/_exporter.py +2 -5
- myokit/formats/matlab/template/main.m +3 -2
- myokit/formats/opencl/__init__.py +0 -3
- myokit/formats/opencl/_ewriter.py +2 -4
- myokit/formats/opencl/_exporter.py +2 -5
- myokit/formats/opencl/template/cable.c +10 -10
- myokit/formats/opencl/template/kernel.cl +1 -1
- myokit/formats/opencl/template/minilog.py +1 -1
- 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 +14 -14
- myokit/formats/sbml/__init__.py +0 -3
- myokit/formats/sbml/_api.py +50 -44
- 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 +2 -5
- myokit/formats/stan/template/cell.stan +3 -3
- 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 +2 -8
- 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 +80 -246
- myokit/gui/datablock_viewer.py +103 -86
- myokit/gui/datalog_viewer.py +214 -66
- myokit/gui/explorer.py +15 -21
- myokit/gui/ide.py +171 -144
- myokit/gui/progress.py +9 -9
- myokit/gui/source.py +406 -375
- myokit/gui/vargrapher.py +2 -12
- myokit/lib/deps.py +12 -13
- myokit/lib/guess.py +3 -4
- myokit/lib/hh.py +20 -18
- myokit/lib/markov.py +21 -20
- myokit/lib/multi.py +1 -3
- myokit/lib/plots.py +20 -9
- 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 +3 -6
- myokit/tests/data/beeler-1977-model-compare-b.mmt +2 -2
- myokit/tests/data/clancy-1999-fitting.mmt +1 -0
- myokit/tests/test_aux.py +13 -28
- myokit/tests/test_cellml_v1_api.py +4 -19
- 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 +4 -19
- myokit/tests/test_cellml_v2_parser.py +0 -15
- myokit/tests/test_cellml_v2_writer.py +0 -9
- myokit/tests/test_cmodel.py +16 -22
- myokit/tests/test_compiler_detection.py +1 -11
- myokit/tests/test_component.py +108 -56
- myokit/tests/test_config.py +34 -67
- myokit/tests/test_datablock.py +1 -9
- myokit/tests/test_datalog.py +19 -24
- 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 +27 -27
- myokit/tests/test_jacobian_calculator.py +6 -14
- 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 +18 -12
- myokit/tests/test_lib_markov.py +21 -13
- myokit/tests/test_lib_multi.py +0 -9
- myokit/tests/test_lib_plots.py +13 -8
- myokit/tests/test_meta.py +0 -3
- myokit/tests/test_model.py +390 -96
- myokit/tests/test_model_building.py +44 -96
- myokit/tests/test_opencl_info.py +5 -14
- myokit/tests/test_pacing_factory.py +0 -3
- myokit/tests/test_pacing_system_c.py +1 -23
- myokit/tests/test_pacing_system_py.py +0 -9
- myokit/tests/test_parsing.py +139 -56
- myokit/tests/test_progress_reporters.py +0 -3
- myokit/tests/test_protocol.py +0 -9
- myokit/tests/test_protocol_floating_point.py +1 -10
- myokit/tests/test_protocol_time_series.py +82 -0
- 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 +27 -42
- myokit/tests/test_sbml_parser.py +4 -19
- myokit/tests/test_simulation_1d.py +45 -25
- myokit/tests/test_simulation_cvodes.py +321 -55
- myokit/tests/test_simulation_cvodes_from_disk.py +0 -3
- myokit/tests/test_simulation_fiber_tissue.py +39 -12
- myokit/tests/test_simulation_log_interval.py +1 -431
- myokit/tests/test_simulation_opencl.py +69 -48
- 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 +1 -10
- myokit/tests/test_user_functions.py +0 -10
- myokit/tests/test_variable.py +231 -27
- myokit/tools.py +5 -21
- myokit/units.py +5 -3
- {myokit-1.33.9.dist-info → myokit-1.35.0.dist-info}/METADATA +12 -15
- myokit-1.35.0.dist-info/RECORD +391 -0
- {myokit-1.33.9.dist-info → myokit-1.35.0.dist-info}/WHEEL +1 -1
- {myokit-1.33.9.dist-info → myokit-1.35.0.dist-info}/entry_points.txt +0 -1
- myokit/_exec_new.py +0 -15
- myokit/_exec_old.py +0 -15
- myokit/_sim/cvodesim.c +0 -1551
- myokit/_sim/cvodesim.py +0 -674
- myokit/_sim/icsim.cpp +0 -563
- myokit/_sim/icsim.py +0 -363
- myokit/_sim/psim.cpp +0 -656
- myokit/_sim/psim.py +0 -493
- myokit/lib/common.py +0 -1094
- myokit/tests/test_lib_common.py +0 -130
- myokit/tests/test_simulation_cvode.py +0 -612
- myokit/tests/test_simulation_ic.py +0 -108
- myokit/tests/test_simulation_p.py +0 -223
- myokit-1.33.9.dist-info/RECORD +0 -403
- /myokit/formats/opencl/template/{test → test.sh} +0 -0
- {myokit-1.33.9.dist-info → myokit-1.35.0.dist-info}/LICENSE.txt +0 -0
- {myokit-1.33.9.dist-info → myokit-1.35.0.dist-info}/top_level.txt +0 -0
myokit/tests/test_expressions.py
CHANGED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import pickle
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -15,12 +12,6 @@ import numpy as np
|
|
|
15
12
|
|
|
16
13
|
import myokit
|
|
17
14
|
|
|
18
|
-
# Unit testing in Python 2 and 3
|
|
19
|
-
try:
|
|
20
|
-
unittest.TestCase.assertRaisesRegex
|
|
21
|
-
except AttributeError:
|
|
22
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
23
|
-
|
|
24
15
|
|
|
25
16
|
# Unit --> See test_units.py
|
|
26
17
|
# Quantity --> See test_units.py
|
myokit/tests/test_float.py
CHANGED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import sys
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -91,8 +88,7 @@ class FloatTest(unittest.TestCase):
|
|
|
91
88
|
# Test float to string conversion.
|
|
92
89
|
|
|
93
90
|
# String should be passed through
|
|
94
|
-
|
|
95
|
-
self.assertEqual(myokit.float.str(str('123')), '123')
|
|
91
|
+
self.assertEqual(myokit.float.str('123'), '123')
|
|
96
92
|
|
|
97
93
|
# Simple numbers
|
|
98
94
|
self.assertEqual(myokit.float.str(0), '0')
|
myokit/tests/test_formats.py
CHANGED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import unittest
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
@@ -15,12 +12,6 @@ import myokit.formats
|
|
|
15
12
|
|
|
16
13
|
from myokit.tests import TemporaryDirectory
|
|
17
14
|
|
|
18
|
-
# Unit testing in Python 2 and 3
|
|
19
|
-
try:
|
|
20
|
-
unittest.TestCase.assertRaisesRegex
|
|
21
|
-
except AttributeError:
|
|
22
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
23
|
-
|
|
24
15
|
|
|
25
16
|
class FormatsTest(unittest.TestCase):
|
|
26
17
|
"""
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
10
|
+
|
|
13
11
|
import numpy as np
|
|
14
12
|
|
|
15
13
|
import myokit
|
|
@@ -17,12 +15,6 @@ import myokit.formats.axon as axon
|
|
|
17
15
|
|
|
18
16
|
from myokit.tests import TemporaryDirectory, DIR_FORMATS
|
|
19
17
|
|
|
20
|
-
# Unit testing in Python 2 and 3
|
|
21
|
-
try:
|
|
22
|
-
unittest.TestCase.assertRaisesRegex
|
|
23
|
-
except AttributeError:
|
|
24
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
25
|
-
|
|
26
18
|
|
|
27
19
|
class AbfTest(unittest.TestCase):
|
|
28
20
|
"""
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import re
|
|
13
10
|
import unittest
|
|
@@ -23,18 +20,6 @@ from myokit.tests import TemporaryDirectory, DIR_FORMATS, WarningCollector
|
|
|
23
20
|
# CellML dir
|
|
24
21
|
DIR = os.path.join(DIR_FORMATS, 'cellml')
|
|
25
22
|
|
|
26
|
-
# Unit testing in Python 2 and 3
|
|
27
|
-
try:
|
|
28
|
-
unittest.TestCase.assertRaisesRegex
|
|
29
|
-
except AttributeError:
|
|
30
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
31
|
-
|
|
32
|
-
# Strings in Python 2 and 3
|
|
33
|
-
try:
|
|
34
|
-
basestring
|
|
35
|
-
except NameError: # pragma: no python 2 cover
|
|
36
|
-
basestring = str
|
|
37
|
-
|
|
38
23
|
|
|
39
24
|
class CellMLExporterTest(unittest.TestCase):
|
|
40
25
|
"""
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -20,18 +17,6 @@ from myokit.tests import DIR_FORMATS, WarningCollector
|
|
|
20
17
|
# ChannelML dir
|
|
21
18
|
DIR = os.path.join(DIR_FORMATS, 'channelml')
|
|
22
19
|
|
|
23
|
-
# Unit testing in Python 2 and 3
|
|
24
|
-
try:
|
|
25
|
-
unittest.TestCase.assertRaisesRegex
|
|
26
|
-
except AttributeError: # pragma: no python 3 cover
|
|
27
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
28
|
-
|
|
29
|
-
# Strings in Python 2 and 3
|
|
30
|
-
try:
|
|
31
|
-
basestring
|
|
32
|
-
except NameError: # pragma: no python 2 cover
|
|
33
|
-
basestring = str
|
|
34
|
-
|
|
35
20
|
|
|
36
21
|
class ChannelMLTest(unittest.TestCase):
|
|
37
22
|
""" Test ChannelML importing. """
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -17,17 +14,6 @@ import myokit.formats.easyml
|
|
|
17
14
|
|
|
18
15
|
from myokit.tests import TemporaryDirectory, WarningCollector, DIR_DATA
|
|
19
16
|
|
|
20
|
-
# Unit testing in Python 2 and 3
|
|
21
|
-
try:
|
|
22
|
-
unittest.TestCase.assertRaisesRegex
|
|
23
|
-
except AttributeError: # pragma: no python 3 cover
|
|
24
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
25
|
-
|
|
26
|
-
# Strings in Python 2 and 3
|
|
27
|
-
try:
|
|
28
|
-
basestring
|
|
29
|
-
except NameError: # pragma: no python 2 cover
|
|
30
|
-
basestring = str
|
|
31
17
|
|
|
32
18
|
# Model that requires unit conversion
|
|
33
19
|
units_model = """
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -16,18 +13,6 @@ import myokit.formats
|
|
|
16
13
|
|
|
17
14
|
from myokit.tests import TemporaryDirectory
|
|
18
15
|
|
|
19
|
-
# Unit testing in Python 2 and 3
|
|
20
|
-
try:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex
|
|
22
|
-
except AttributeError: # pragma: no python 3 cover
|
|
23
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
24
|
-
|
|
25
|
-
# Strings in Python 2 and 3
|
|
26
|
-
try:
|
|
27
|
-
basestring
|
|
28
|
-
except NameError: # pragma: no python 2 cover
|
|
29
|
-
basestring = str
|
|
30
|
-
|
|
31
16
|
|
|
32
17
|
class ExportTest(unittest.TestCase):
|
|
33
18
|
"""
|
|
@@ -38,7 +23,7 @@ class ExportTest(unittest.TestCase):
|
|
|
38
23
|
""" Test a given exporter `e`. """
|
|
39
24
|
|
|
40
25
|
# Test info method.
|
|
41
|
-
self.assertIsInstance(e.post_export_info(),
|
|
26
|
+
self.assertIsInstance(e.post_export_info(), str)
|
|
42
27
|
|
|
43
28
|
# Load model, protocol
|
|
44
29
|
m, p = model, protocol
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import unittest
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
@@ -20,19 +17,6 @@ import myokit.formats.python
|
|
|
20
17
|
import myokit.formats.stan
|
|
21
18
|
|
|
22
19
|
|
|
23
|
-
# Unit testing in Python 2 and 3
|
|
24
|
-
try:
|
|
25
|
-
unittest.TestCase.assertRaisesRegex
|
|
26
|
-
except AttributeError: # pragma: no python 3 cover
|
|
27
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
28
|
-
|
|
29
|
-
# Strings in Python 2 and 3
|
|
30
|
-
try:
|
|
31
|
-
basestring
|
|
32
|
-
except NameError: # pragma: no python 2 cover
|
|
33
|
-
basestring = str
|
|
34
|
-
|
|
35
|
-
|
|
36
20
|
class ExpressionWriterTest(unittest.TestCase):
|
|
37
21
|
""" Test shared expression writer functionality. """
|
|
38
22
|
|
|
@@ -45,7 +29,7 @@ class ExpressionWriterTest(unittest.TestCase):
|
|
|
45
29
|
|
|
46
30
|
# Create one of each
|
|
47
31
|
for e in es:
|
|
48
|
-
self.assertIsInstance(e,
|
|
32
|
+
self.assertIsInstance(e, str)
|
|
49
33
|
e = myokit.formats.ewriter(e)
|
|
50
34
|
self.assertTrue(isinstance(e, myokit.formats.ExpressionWriter))
|
|
51
35
|
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import unittest
|
|
12
9
|
|
|
13
10
|
import myokit.formats.html
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -16,18 +13,6 @@ import myokit.formats as formats
|
|
|
16
13
|
|
|
17
14
|
from myokit.tests import DIR_FORMATS
|
|
18
15
|
|
|
19
|
-
# Unit testing in Python 2 and 3
|
|
20
|
-
try:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex
|
|
22
|
-
except AttributeError: # pragma: no python 3 cover
|
|
23
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
24
|
-
|
|
25
|
-
# Strings in Python 2 and 3
|
|
26
|
-
try:
|
|
27
|
-
basestring
|
|
28
|
-
except NameError: # pragma: no python 2 cover
|
|
29
|
-
basestring = str
|
|
30
|
-
|
|
31
16
|
|
|
32
17
|
class ImporterTest(unittest.TestCase):
|
|
33
18
|
""" Test shared importer functionality. """
|
|
@@ -37,7 +22,7 @@ class ImporterTest(unittest.TestCase):
|
|
|
37
22
|
ims = myokit.formats.importers()
|
|
38
23
|
self.assertTrue(len(ims) > 0)
|
|
39
24
|
for i in ims:
|
|
40
|
-
self.assertIsInstance(i,
|
|
25
|
+
self.assertIsInstance(i, str)
|
|
41
26
|
i = myokit.formats.importer(i)
|
|
42
27
|
self.assertTrue(isinstance(i, myokit.formats.Importer))
|
|
43
28
|
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import re
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -16,12 +13,6 @@ import lxml.etree as etree
|
|
|
16
13
|
import myokit
|
|
17
14
|
import myokit.formats.mathml as mathml
|
|
18
15
|
|
|
19
|
-
# Unit testing in Python 2 and 3
|
|
20
|
-
try:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex
|
|
22
|
-
except AttributeError:
|
|
23
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
24
|
-
|
|
25
16
|
|
|
26
17
|
class ContentMathMLParserTest(unittest.TestCase):
|
|
27
18
|
""" Tests content MathML parsing. """
|
|
@@ -5,21 +5,12 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import re
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
14
11
|
import myokit
|
|
15
12
|
import myokit.formats.mathml as mathml
|
|
16
13
|
|
|
17
|
-
# Unit testing in Python 2 and 3
|
|
18
|
-
try:
|
|
19
|
-
unittest.TestCase.assertRaisesRegex
|
|
20
|
-
except AttributeError:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
22
|
-
|
|
23
14
|
|
|
24
15
|
class PresentationMathMLTest(unittest.TestCase):
|
|
25
16
|
"""
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import unittest
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
@@ -15,13 +12,6 @@ import myokit.formats
|
|
|
15
12
|
import myokit.formats.opencl
|
|
16
13
|
|
|
17
14
|
|
|
18
|
-
# Unit testing in Python 2 and 3
|
|
19
|
-
try:
|
|
20
|
-
unittest.TestCase.assertRaisesRegex
|
|
21
|
-
except AttributeError: # pragma: no python 3 cover
|
|
22
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
23
|
-
|
|
24
|
-
|
|
25
15
|
class OpenCLExpressionWriterTest(unittest.TestCase):
|
|
26
16
|
""" Test the OpenCL ewriter class. """
|
|
27
17
|
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -20,18 +17,6 @@ import myokit.formats.sbml
|
|
|
20
17
|
# from shared import DIR_FORMATS, WarningCollector
|
|
21
18
|
from myokit.tests import DIR_FORMATS, WarningCollector
|
|
22
19
|
|
|
23
|
-
# Unit testing in Python 2 and 3
|
|
24
|
-
try:
|
|
25
|
-
unittest.TestCase.assertRaisesRegex
|
|
26
|
-
except AttributeError: # pragma: no python 3 cover
|
|
27
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
28
|
-
|
|
29
|
-
# Strings in Python 2 and 3
|
|
30
|
-
try:
|
|
31
|
-
basestring
|
|
32
|
-
except NameError: # pragma: no python 2 cover
|
|
33
|
-
basestring = str
|
|
34
|
-
|
|
35
20
|
|
|
36
21
|
class SBMLImporterTest(unittest.TestCase):
|
|
37
22
|
"""
|
|
@@ -5,20 +5,11 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import unittest
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
14
11
|
import myokit.formats.sympy as mypy
|
|
15
12
|
|
|
16
|
-
# Unit testing in Python 2 and 3
|
|
17
|
-
try:
|
|
18
|
-
unittest.TestCase.assertRaisesRegex
|
|
19
|
-
except AttributeError:
|
|
20
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
21
|
-
|
|
22
13
|
|
|
23
14
|
class SymPyReadWriteTest(unittest.TestCase):
|
|
24
15
|
"""
|
myokit/tests/test_formats_wcp.py
CHANGED
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
10
|
+
|
|
13
11
|
import numpy as np
|
|
14
12
|
|
|
15
13
|
import myokit.formats.wcp as wcp
|
myokit/tests/test_io.py
CHANGED
|
@@ -6,23 +6,15 @@
|
|
|
6
6
|
# This file is part of Myokit.
|
|
7
7
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
8
8
|
#
|
|
9
|
-
from __future__ import absolute_import, division
|
|
10
|
-
from __future__ import print_function, unicode_literals
|
|
11
|
-
|
|
12
9
|
import os
|
|
13
10
|
import unittest
|
|
11
|
+
|
|
14
12
|
import numpy as np
|
|
15
13
|
|
|
16
14
|
import myokit
|
|
17
15
|
|
|
18
16
|
from myokit.tests import DIR_DATA, TemporaryDirectory
|
|
19
17
|
|
|
20
|
-
# Strings in Python 2 and 3
|
|
21
|
-
try:
|
|
22
|
-
basestring
|
|
23
|
-
except NameError:
|
|
24
|
-
basestring = str
|
|
25
|
-
|
|
26
18
|
|
|
27
19
|
class LoadSaveMmtTest(unittest.TestCase):
|
|
28
20
|
"""Tests load/save functions for mmt files."""
|
|
@@ -105,7 +97,7 @@ class LoadSaveMmtTest(unittest.TestCase):
|
|
|
105
97
|
m, p, x = myokit.load(spath)
|
|
106
98
|
self.assertIsNone(m)
|
|
107
99
|
self.assertIsNone(p)
|
|
108
|
-
self.assertTrue(isinstance(x,
|
|
100
|
+
self.assertTrue(isinstance(x, str))
|
|
109
101
|
|
|
110
102
|
self.assertRaises(
|
|
111
103
|
myokit.SectionNotFoundError, myokit.load_model, ppath)
|
|
@@ -128,7 +120,7 @@ class LoadSaveMmtTest(unittest.TestCase):
|
|
|
128
120
|
m, p, x = myokit.load('example')
|
|
129
121
|
self.assertIsInstance(m, myokit.Model)
|
|
130
122
|
self.assertIsInstance(p, myokit.Protocol)
|
|
131
|
-
self.assertTrue(isinstance(x,
|
|
123
|
+
self.assertTrue(isinstance(x, str))
|
|
132
124
|
|
|
133
125
|
# Save all three and reload
|
|
134
126
|
with TemporaryDirectory() as d:
|
|
@@ -255,6 +247,12 @@ class LoadSaveMmtTest(unittest.TestCase):
|
|
|
255
247
|
text = f.read()
|
|
256
248
|
self.assertEqual(text, myokit.save(model=m, protocol=p, script=x))
|
|
257
249
|
|
|
250
|
+
# Save nothing
|
|
251
|
+
with TemporaryDirectory() as d:
|
|
252
|
+
opath = d.path('test.mmt')
|
|
253
|
+
self.assertRaises(ValueError, myokit.save, opath)
|
|
254
|
+
self.assertFalse(os.path.exists(opath))
|
|
255
|
+
|
|
258
256
|
def test_save_model(self):
|
|
259
257
|
# Test if the correct parts are saved/loaded from disk using the
|
|
260
258
|
# ``save_model()`` method.
|
|
@@ -312,10 +310,10 @@ class LoadSaveMmtTest(unittest.TestCase):
|
|
|
312
310
|
ipath = os.path.join(DIR_DATA, 'lr-1991.mmt')
|
|
313
311
|
# Test example loading
|
|
314
312
|
x = myokit.load_script('example')
|
|
315
|
-
self.assertTrue(isinstance(x,
|
|
313
|
+
self.assertTrue(isinstance(x, str))
|
|
316
314
|
# Test file loading
|
|
317
315
|
x = myokit.load_script(ipath)
|
|
318
|
-
self.assertTrue(isinstance(x,
|
|
316
|
+
self.assertTrue(isinstance(x, str))
|
|
319
317
|
with TemporaryDirectory() as d:
|
|
320
318
|
opath = d.path('test.mmt')
|
|
321
319
|
myokit.save_script(opath, x)
|
|
@@ -327,7 +325,7 @@ class LoadSaveMmtTest(unittest.TestCase):
|
|
|
327
325
|
self.assertTrue('[[script]]' in text)
|
|
328
326
|
# Test reloading
|
|
329
327
|
xx = myokit.load_script(opath)
|
|
330
|
-
self.assertTrue(isinstance(xx,
|
|
328
|
+
self.assertTrue(isinstance(xx, str))
|
|
331
329
|
self.assertEqual(x, xx)
|
|
332
330
|
|
|
333
331
|
|
|
@@ -340,22 +338,22 @@ class LoadSaveStateTest(unittest.TestCase):
|
|
|
340
338
|
with TemporaryDirectory() as d:
|
|
341
339
|
# Test save and load without model
|
|
342
340
|
f = d.path('state.txt')
|
|
343
|
-
myokit.save_state(f, m.
|
|
344
|
-
self.assertEqual(myokit.load_state(f), m.
|
|
341
|
+
myokit.save_state(f, m.initial_values(True))
|
|
342
|
+
self.assertEqual(myokit.load_state(f), m.initial_values(True))
|
|
345
343
|
|
|
346
344
|
# Test save and load with model argument
|
|
347
|
-
myokit.save_state(f, m.
|
|
348
|
-
self.assertEqual(myokit.load_state(f, m), m.
|
|
345
|
+
myokit.save_state(f, m.initial_values(True), m)
|
|
346
|
+
self.assertEqual(myokit.load_state(f, m), m.initial_values(True))
|
|
349
347
|
|
|
350
348
|
# Save without, load with model
|
|
351
|
-
myokit.save_state(f, m.
|
|
352
|
-
self.assertEqual(myokit.load_state(f, m), m.
|
|
349
|
+
myokit.save_state(f, m.initial_values(True))
|
|
350
|
+
self.assertEqual(myokit.load_state(f, m), m.initial_values(True))
|
|
353
351
|
|
|
354
352
|
# Save with model, load without
|
|
355
353
|
# Loaded version is dict!
|
|
356
|
-
myokit.save_state(f, m.
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
myokit.save_state(f, m.initial_values(True), m)
|
|
355
|
+
self.assertEqual(myokit.load_state(f), dict(zip(
|
|
356
|
+
[v.qname() for v in m.states()], m.initial_values(True))))
|
|
359
357
|
|
|
360
358
|
def test_load_save_state_bin(self):
|
|
361
359
|
# Test loading/saving state in binary format.
|
|
@@ -364,13 +362,15 @@ class LoadSaveStateTest(unittest.TestCase):
|
|
|
364
362
|
|
|
365
363
|
# Test save and load with double precision
|
|
366
364
|
f = d.path('state.bin')
|
|
367
|
-
myokit.save_state_bin(f, m.
|
|
368
|
-
self.assertEqual(myokit.load_state_bin(f), m.
|
|
365
|
+
myokit.save_state_bin(f, m.initial_values(True))
|
|
366
|
+
self.assertEqual(myokit.load_state_bin(f), m.initial_values(True))
|
|
369
367
|
|
|
370
368
|
# Test save and load with single precision
|
|
371
369
|
f = d.path('state.bin')
|
|
372
|
-
myokit.save_state_bin(
|
|
373
|
-
|
|
370
|
+
myokit.save_state_bin(
|
|
371
|
+
f, m.initial_values(True), myokit.SINGLE_PRECISION)
|
|
372
|
+
d = np.array(myokit.load_state_bin(f))
|
|
373
|
+
d -= np.array(m.initial_values(True))
|
|
374
374
|
self.assertTrue(np.all(np.abs(d) < 1e-5)) # Not very precise!
|
|
375
375
|
|
|
376
376
|
|
|
@@ -5,23 +5,15 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
10
|
+
|
|
13
11
|
import numpy as np
|
|
14
12
|
|
|
15
13
|
import myokit
|
|
16
14
|
|
|
17
15
|
from myokit.tests import DIR_DATA
|
|
18
16
|
|
|
19
|
-
# Unit testing in Python 2 and 3
|
|
20
|
-
try:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex
|
|
22
|
-
except AttributeError:
|
|
23
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
24
|
-
|
|
25
17
|
|
|
26
18
|
class JacobianCalculatorTest(unittest.TestCase):
|
|
27
19
|
"""
|
|
@@ -37,16 +29,16 @@ class JacobianCalculatorTest(unittest.TestCase):
|
|
|
37
29
|
|
|
38
30
|
# Test if still runs with initial x all zero
|
|
39
31
|
# (But does cause a linear algebra issue in this case)
|
|
40
|
-
x = np.zeros(
|
|
32
|
+
x = np.zeros(m.count_states())
|
|
41
33
|
c.newton_root(x, damping=0.01, max_iter=50)
|
|
42
34
|
|
|
43
35
|
# Test if still works with a single zero (Enno's bug)
|
|
44
|
-
x = np.array(m.
|
|
36
|
+
x = np.array(m.initial_values(True))
|
|
45
37
|
x[1] = 0
|
|
46
38
|
x, f, j, e = c.newton_root(x, damping=0.01, max_iter=50)
|
|
47
39
|
|
|
48
40
|
# Test quick return
|
|
49
|
-
x = np.array(m.
|
|
41
|
+
x = np.array(m.initial_values(True))
|
|
50
42
|
x[0] = 0
|
|
51
43
|
x2, f, j, e = c.newton_root(damping=0.01, max_iter=1)
|
|
52
44
|
self.assertTrue(np.sum((x2 - x)**2) > 10)
|
|
@@ -58,12 +50,12 @@ class JacobianCalculatorTest(unittest.TestCase):
|
|
|
58
50
|
ValueError, 'Damping', c.newton_root, damping=1.1)
|
|
59
51
|
|
|
60
52
|
# Missing a state
|
|
61
|
-
x = m.
|
|
53
|
+
x = m.initial_values(True)[:-1]
|
|
62
54
|
self.assertRaisesRegex(
|
|
63
55
|
ValueError, 'must have length', c.calculate, x)
|
|
64
56
|
|
|
65
57
|
# Non-numbers in state
|
|
66
|
-
x = m.
|
|
58
|
+
x = m.initial_values(True)
|
|
67
59
|
x[0] = 'Hello'
|
|
68
60
|
self.assertRaisesRegex(
|
|
69
61
|
ValueError, 'floats', c.calculate, x)
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
@@ -15,12 +12,6 @@ import myokit
|
|
|
15
12
|
|
|
16
13
|
from myokit.tests import DIR_DATA
|
|
17
14
|
|
|
18
|
-
# Unit testing in Python 2 and 3
|
|
19
|
-
try:
|
|
20
|
-
unittest.TestCase.assertRaisesRegex
|
|
21
|
-
except AttributeError:
|
|
22
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
23
|
-
|
|
24
15
|
|
|
25
16
|
class JacobianTracerTest(unittest.TestCase):
|
|
26
17
|
"""
|
myokit/tests/test_lib_deps.py
CHANGED
|
@@ -5,21 +5,12 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import random
|
|
12
9
|
import unittest
|
|
13
10
|
|
|
14
11
|
import myokit
|
|
15
12
|
import myokit.lib.deps as deps
|
|
16
13
|
|
|
17
|
-
# Unit testing in Python 2 and 3
|
|
18
|
-
try:
|
|
19
|
-
unittest.TestCase.assertRaisesRegex
|
|
20
|
-
except AttributeError:
|
|
21
|
-
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
|
|
22
|
-
|
|
23
14
|
|
|
24
15
|
class LibDepsTest(unittest.TestCase):
|
|
25
16
|
|