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/ansic/__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 AnsiCExporter, AnsiCCableExporter, AnsiCEulerExporter
|
|
11
8
|
from ._ewriter import AnsiCExpressionWriter
|
|
12
9
|
|
myokit/formats/ansic/_ewriter.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.python import PythonExpressionWriter
|
|
12
10
|
|
|
13
11
|
|
|
@@ -17,7 +15,7 @@ class AnsiCExpressionWriter(PythonExpressionWriter):
|
|
|
17
15
|
equations for variables in a C-style syntax.
|
|
18
16
|
"""
|
|
19
17
|
def __init__(self):
|
|
20
|
-
super(
|
|
18
|
+
super().__init__()
|
|
21
19
|
self._function_prefix = ''
|
|
22
20
|
self._fcond = None
|
|
23
21
|
|
myokit/formats/axon/__init__.py
CHANGED
|
@@ -4,13 +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
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
from ._abf import AbfFile, Sweep, Channel # noqa
|
|
11
8
|
from ._atf import AtfFile, load_atf, save_atf # noqa
|
|
12
9
|
from ._importer import AbfImporter
|
|
13
10
|
|
|
11
|
+
|
|
14
12
|
# Importers
|
|
15
13
|
_importers = {
|
|
16
14
|
'abf': AbfImporter,
|
myokit/formats/axon/_abf.py
CHANGED
|
@@ -139,23 +139,22 @@
|
|
|
139
139
|
# Information - but no direct code - from the matlab script get_abf_header.m
|
|
140
140
|
# was also used: http://neurodata.hg.sourceforge.net/hgweb/neurodata/neurodata/
|
|
141
141
|
#------------------------------------------------------------------------------
|
|
142
|
-
from __future__ import absolute_import, division
|
|
143
|
-
from __future__ import print_function, unicode_literals
|
|
144
|
-
|
|
145
|
-
from collections import OrderedDict
|
|
146
|
-
import numpy as np
|
|
147
|
-
import traceback
|
|
148
142
|
import datetime
|
|
149
143
|
import logging
|
|
150
|
-
import struct
|
|
151
144
|
import os
|
|
145
|
+
import struct
|
|
146
|
+
import traceback
|
|
147
|
+
|
|
148
|
+
import numpy as np
|
|
149
|
+
|
|
150
|
+
from collections import OrderedDict
|
|
152
151
|
|
|
153
152
|
|
|
154
153
|
# Encoding for text parts of files
|
|
155
154
|
_ENC = 'latin-1'
|
|
156
155
|
|
|
157
156
|
|
|
158
|
-
class AbfFile
|
|
157
|
+
class AbfFile:
|
|
159
158
|
"""
|
|
160
159
|
Represents a read-only Axon Binary Format file (``.abf``), stored at the
|
|
161
160
|
location pointed to by ``filepath``.
|
|
@@ -199,7 +198,6 @@ class AbfFile(object):
|
|
|
199
198
|
"""
|
|
200
199
|
def __init__(self, filepath, is_protocol_file=None):
|
|
201
200
|
# The path to the file and its basename
|
|
202
|
-
# Ensure it's a `str` for Python2/3 compatibility
|
|
203
201
|
filepath = str(filepath)
|
|
204
202
|
self._filepath = os.path.abspath(filepath)
|
|
205
203
|
self._filename = os.path.basename(filepath)
|
|
@@ -702,7 +700,6 @@ class AbfFile(object):
|
|
|
702
700
|
"""
|
|
703
701
|
Read and unpack a file section using the given format ``form``.
|
|
704
702
|
"""
|
|
705
|
-
# Form must be a str (so bytes on Python 2)
|
|
706
703
|
form = str(form)
|
|
707
704
|
if offset is not None:
|
|
708
705
|
f.seek(offset)
|
|
@@ -1306,14 +1303,14 @@ class AbfFile(object):
|
|
|
1306
1303
|
self._adc_offsets.append(s)
|
|
1307
1304
|
|
|
1308
1305
|
|
|
1309
|
-
class Sweep
|
|
1306
|
+
class Sweep:
|
|
1310
1307
|
"""
|
|
1311
1308
|
Represents a single sweep (also called an 'episode')
|
|
1312
1309
|
|
|
1313
1310
|
A sweep is represented as a fixed-size list of channels.
|
|
1314
1311
|
"""
|
|
1315
1312
|
def __init__(self, n):
|
|
1316
|
-
super(
|
|
1313
|
+
super().__init__()
|
|
1317
1314
|
n = int(n)
|
|
1318
1315
|
if n < 0: # pragma: no cover
|
|
1319
1316
|
raise ValueError('Number channels cannot be negative.')
|
|
@@ -1336,14 +1333,14 @@ class Sweep(object):
|
|
|
1336
1333
|
self._channels[key] = value
|
|
1337
1334
|
|
|
1338
1335
|
|
|
1339
|
-
class Channel
|
|
1336
|
+
class Channel:
|
|
1340
1337
|
"""
|
|
1341
1338
|
Represents an analog signal for a single channel.
|
|
1342
1339
|
|
|
1343
1340
|
To obtain this channel's formatted data, use times() and trace()
|
|
1344
1341
|
"""
|
|
1345
1342
|
def __init__(self, parent_file):
|
|
1346
|
-
super(
|
|
1343
|
+
super().__init__()
|
|
1347
1344
|
self._parent_file = parent_file # The abf file this channel is from
|
|
1348
1345
|
self._type = TYPE_UNKNOWN # Type of recording
|
|
1349
1346
|
|
|
@@ -1386,7 +1383,7 @@ class Channel(object):
|
|
|
1386
1383
|
def number(self):
|
|
1387
1384
|
"""
|
|
1388
1385
|
Returns the channel index used by pClamp. Note that this does not
|
|
1389
|
-
necessarily equal its index in the
|
|
1386
|
+
necessarily equal its index in the Python sweep data!
|
|
1390
1387
|
"""
|
|
1391
1388
|
return self._numb
|
|
1392
1389
|
|
myokit/formats/axon/_atf.py
CHANGED
|
@@ -4,20 +4,19 @@
|
|
|
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
|
-
from collections import OrderedDict
|
|
11
|
-
import numpy as np
|
|
12
7
|
import os
|
|
13
8
|
import re
|
|
14
9
|
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
from collections import OrderedDict
|
|
13
|
+
|
|
15
14
|
|
|
16
15
|
# Format used for any text
|
|
17
16
|
_ENC = 'ascii'
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
class AtfFile
|
|
19
|
+
class AtfFile:
|
|
21
20
|
"""
|
|
22
21
|
Represents an Axon Text File (ATF) stored on disk.
|
|
23
22
|
|
myokit/formats/axon/_importer.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 CellMLExporter, CellML1Exporter, CellML2Exporter
|
|
11
8
|
from ._ewriter import CellMLExpressionWriter
|
|
12
9
|
from ._importer import CellMLImporter, CellMLImporterError # noqa
|
|
@@ -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
|
|
@@ -24,8 +21,8 @@ class CellMLExpressionWriter(MathMLExpressionWriter):
|
|
|
24
21
|
unit names with :meth:`set_unit_function()`.
|
|
25
22
|
"""
|
|
26
23
|
def __init__(self, version='1.0'):
|
|
27
|
-
super(
|
|
28
|
-
super(
|
|
24
|
+
super().__init__()
|
|
25
|
+
super().set_mode(presentation=False)
|
|
29
26
|
|
|
30
27
|
# Units lookup method
|
|
31
28
|
self._funits = None
|
|
@@ -54,7 +51,7 @@ class CellMLExpressionWriter(MathMLExpressionWriter):
|
|
|
54
51
|
self._funits = f
|
|
55
52
|
|
|
56
53
|
def _ex_number(self, e, t):
|
|
57
|
-
x = super(
|
|
54
|
+
x = super()._ex_number(e, t)
|
|
58
55
|
unit = e.unit()
|
|
59
56
|
if self._funits is not None and unit is not None:
|
|
60
57
|
units = self._funits(e.unit())
|
|
@@ -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
|
|
11
8
|
import myokit.lib.guess
|
|
12
9
|
|
|
@@ -18,7 +15,7 @@ class CellMLExporter(myokit.formats.Exporter):
|
|
|
18
15
|
This:class:`Exporter <myokit.formats.Exporter>` creates a CellML model.
|
|
19
16
|
"""
|
|
20
17
|
def __init__(self):
|
|
21
|
-
super(
|
|
18
|
+
super().__init__()
|
|
22
19
|
|
|
23
20
|
def model(self, path, model, protocol=None, version='1.0'):
|
|
24
21
|
"""
|
|
@@ -69,7 +66,7 @@ class CellML1Exporter(CellMLExporter):
|
|
|
69
66
|
This:class:`Exporter <myokit.formats.Exporter>` creates a CellML 1.0 model.
|
|
70
67
|
"""
|
|
71
68
|
def model(self, path, model, protocol=None):
|
|
72
|
-
super(
|
|
69
|
+
super().model(path, model, protocol, '1.0')
|
|
73
70
|
|
|
74
71
|
|
|
75
72
|
class CellML2Exporter(CellMLExporter):
|
|
@@ -77,5 +74,5 @@ class CellML2Exporter(CellMLExporter):
|
|
|
77
74
|
This:class:`Exporter <myokit.formats.Exporter>` creates a CellML 2.0 model.
|
|
78
75
|
"""
|
|
79
76
|
def model(self, path, model, protocol=None):
|
|
80
|
-
super(
|
|
77
|
+
super().model(path, model, protocol, '2.0')
|
|
81
78
|
|
|
@@ -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
|
from lxml import etree
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
@@ -28,7 +25,7 @@ class CellMLImporter(myokit.formats.Importer):
|
|
|
28
25
|
from CellML.
|
|
29
26
|
"""
|
|
30
27
|
def __init__(self, verbose=False):
|
|
31
|
-
super(
|
|
28
|
+
super().__init__()
|
|
32
29
|
|
|
33
30
|
def model(self, path):
|
|
34
31
|
"""
|
|
@@ -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
|
AnnotatableElement,
|
|
12
9
|
CellMLError,
|
|
@@ -22,7 +19,6 @@ from ._api import ( # noqa
|
|
|
22
19
|
is_valid_identifier,
|
|
23
20
|
)
|
|
24
21
|
|
|
25
|
-
|
|
26
22
|
from ._parser import ( # noqa
|
|
27
23
|
parse_file,
|
|
28
24
|
parse_string,
|
myokit/formats/cellml/v1/_api.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 collections
|
|
11
8
|
import re
|
|
12
9
|
import warnings
|
|
@@ -116,7 +113,7 @@ def create_unit_name(unit):
|
|
|
116
113
|
return name
|
|
117
114
|
|
|
118
115
|
|
|
119
|
-
class AnnotatableElement
|
|
116
|
+
class AnnotatableElement:
|
|
120
117
|
"""
|
|
121
118
|
Represents a CellML 1.0 or 1.1 element that can have a cmeta:id.
|
|
122
119
|
|
|
@@ -187,7 +184,7 @@ class UnsupportedBaseUnitsError(UnitsError):
|
|
|
187
184
|
"""
|
|
188
185
|
def __init__(self, units):
|
|
189
186
|
self.units = units
|
|
190
|
-
super(
|
|
187
|
+
super().__init__(
|
|
191
188
|
'Unsupported base units "' + units + '".')
|
|
192
189
|
|
|
193
190
|
|
|
@@ -196,7 +193,7 @@ class UnsupportedUnitOffsetError(UnitsError):
|
|
|
196
193
|
Raised when units with non-zero offsets are used.
|
|
197
194
|
"""
|
|
198
195
|
def __init__(self):
|
|
199
|
-
super(
|
|
196
|
+
super().__init__(
|
|
200
197
|
'Units with non-zero offsets are not supported.')
|
|
201
198
|
|
|
202
199
|
|
|
@@ -206,7 +203,7 @@ class Component(AnnotatableElement):
|
|
|
206
203
|
:meth:`Model.add_component()`.
|
|
207
204
|
"""
|
|
208
205
|
def __init__(self, model, name):
|
|
209
|
-
super(
|
|
206
|
+
super().__init__(model)
|
|
210
207
|
|
|
211
208
|
# Store model
|
|
212
209
|
self._model = model
|
|
@@ -474,7 +471,7 @@ class Model(AnnotatableElement):
|
|
|
474
471
|
|
|
475
472
|
"""
|
|
476
473
|
def __init__(self, name, version='1.0'):
|
|
477
|
-
super(
|
|
474
|
+
super().__init__(self)
|
|
478
475
|
|
|
479
476
|
# Check and store name
|
|
480
477
|
if not is_valid_identifier(name):
|
|
@@ -1165,7 +1162,7 @@ class Model(AnnotatableElement):
|
|
|
1165
1162
|
return self._version
|
|
1166
1163
|
|
|
1167
1164
|
|
|
1168
|
-
class Units
|
|
1165
|
+
class Units:
|
|
1169
1166
|
"""
|
|
1170
1167
|
Represents a CellML units definition, should not be created directly but
|
|
1171
1168
|
only via :meth:`Model.add_units()` or :meth:`Component.add_units()`.
|
|
@@ -1470,7 +1467,7 @@ class Variable(AnnotatableElement):
|
|
|
1470
1467
|
"""
|
|
1471
1468
|
def __init__(self, component, name, units, public_interface='none',
|
|
1472
1469
|
private_interface='none'):
|
|
1473
|
-
super(
|
|
1470
|
+
super().__init__(component.model())
|
|
1474
1471
|
|
|
1475
1472
|
# Store component
|
|
1476
1473
|
self._component = component
|
|
@@ -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 warnings
|
|
12
9
|
|
|
@@ -60,10 +57,10 @@ class CellMLParsingError(myokit.ImportError):
|
|
|
60
57
|
message = 'Error on line ' + line + '. ' + message
|
|
61
58
|
except AttributeError:
|
|
62
59
|
pass
|
|
63
|
-
super(
|
|
60
|
+
super().__init__(message)
|
|
64
61
|
|
|
65
62
|
|
|
66
|
-
class CellMLParser
|
|
63
|
+
class CellMLParser:
|
|
67
64
|
"""
|
|
68
65
|
Parses CellML 1.0 and 1.1 documents, and performs (partial) validation of a
|
|
69
66
|
CellML document.
|
|
@@ -4,21 +4,12 @@
|
|
|
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
|
|
8
|
+
from urllib.parse import quote
|
|
11
9
|
|
|
12
10
|
import myokit
|
|
13
11
|
import myokit.formats.cellml as cellml
|
|
14
12
|
|
|
15
|
-
# Quoting URI strings in Python2 and Python3
|
|
16
|
-
try:
|
|
17
|
-
from urllib.parse import quote
|
|
18
|
-
except ImportError: # pragma: no python 3 cover
|
|
19
|
-
# Python 2
|
|
20
|
-
from urllib import quote
|
|
21
|
-
|
|
22
13
|
|
|
23
14
|
# Left-over from old exporter. Not sure if this had any function.
|
|
24
15
|
# Add name in 'tmp-documentation' format
|
|
@@ -45,7 +36,7 @@ def write_string(model):
|
|
|
45
36
|
return CellMLWriter().write_string(model)
|
|
46
37
|
|
|
47
38
|
|
|
48
|
-
class CellMLWriter
|
|
39
|
+
class CellMLWriter:
|
|
49
40
|
"""
|
|
50
41
|
Writes CellML 1.0 or 1.1 documents.
|
|
51
42
|
"""
|
|
@@ -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
|
AnnotatableElement,
|
|
12
9
|
CellMLError,
|
myokit/formats/cellml/v2/_api.py
CHANGED
|
@@ -4,21 +4,12 @@
|
|
|
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 re
|
|
12
9
|
import warnings
|
|
13
10
|
|
|
14
11
|
import myokit
|
|
15
12
|
|
|
16
|
-
# Strings in Python2 and Python3
|
|
17
|
-
try:
|
|
18
|
-
basestring
|
|
19
|
-
except NameError: # pragma: no cover
|
|
20
|
-
basestring = str
|
|
21
|
-
|
|
22
13
|
|
|
23
14
|
# Data types
|
|
24
15
|
_cellml_identifier = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$')
|
|
@@ -142,7 +133,7 @@ def create_unit_name(unit):
|
|
|
142
133
|
return name
|
|
143
134
|
|
|
144
135
|
|
|
145
|
-
class AnnotatableElement
|
|
136
|
+
class AnnotatableElement:
|
|
146
137
|
"""
|
|
147
138
|
Represents a CellML 2.0 element that can be annotated (using a public dict
|
|
148
139
|
``meta`` that stores key:value pairs).
|
|
@@ -167,7 +158,7 @@ class Component(AnnotatableElement):
|
|
|
167
158
|
:meth:`Model.add_component()`.
|
|
168
159
|
"""
|
|
169
160
|
def __init__(self, model, name):
|
|
170
|
-
super(
|
|
161
|
+
super().__init__()
|
|
171
162
|
|
|
172
163
|
# Store model
|
|
173
164
|
self._model = model
|
|
@@ -323,7 +314,7 @@ class Model(AnnotatableElement):
|
|
|
323
314
|
|
|
324
315
|
"""
|
|
325
316
|
def __init__(self, name, version='2.0'):
|
|
326
|
-
super(
|
|
317
|
+
super().__init__()
|
|
327
318
|
|
|
328
319
|
# Check and store name
|
|
329
320
|
if not is_identifier(name):
|
|
@@ -1068,7 +1059,7 @@ class Model(AnnotatableElement):
|
|
|
1068
1059
|
return self._version
|
|
1069
1060
|
|
|
1070
1061
|
|
|
1071
|
-
class Units
|
|
1062
|
+
class Units:
|
|
1072
1063
|
"""
|
|
1073
1064
|
Represents a CellML units definition; should not be created directly but
|
|
1074
1065
|
only via :meth:`Model.add_units()` or :meth:`Component.add_units()`.
|
|
@@ -1359,7 +1350,7 @@ class Variable(AnnotatableElement):
|
|
|
1359
1350
|
|
|
1360
1351
|
"""
|
|
1361
1352
|
def __init__(self, component, name, units, interface='none'):
|
|
1362
|
-
super(
|
|
1353
|
+
super().__init__()
|
|
1363
1354
|
|
|
1364
1355
|
# Store model and component
|
|
1365
1356
|
self._model = component.model()
|
|
@@ -1615,7 +1606,7 @@ class Variable(AnnotatableElement):
|
|
|
1615
1606
|
if value is not None:
|
|
1616
1607
|
|
|
1617
1608
|
# Check value is a real number string
|
|
1618
|
-
if isinstance(value,
|
|
1609
|
+
if isinstance(value, str):
|
|
1619
1610
|
if is_real_number_string(value):
|
|
1620
1611
|
value = float(value)
|
|
1621
1612
|
else:
|
|
@@ -1642,7 +1633,7 @@ class Variable(AnnotatableElement):
|
|
|
1642
1633
|
return self._units
|
|
1643
1634
|
|
|
1644
1635
|
|
|
1645
|
-
class ConnectedVariableSet
|
|
1636
|
+
class ConnectedVariableSet:
|
|
1646
1637
|
"""
|
|
1647
1638
|
Represents a set of connected variables.
|
|
1648
1639
|
|
|
@@ -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 warnings
|
|
11
8
|
|
|
12
9
|
from lxml import etree
|
|
@@ -59,10 +56,10 @@ class CellMLParsingError(myokit.ImportError):
|
|
|
59
56
|
message = 'Error on line ' + line + '. ' + message
|
|
60
57
|
except AttributeError:
|
|
61
58
|
pass
|
|
62
|
-
super(
|
|
59
|
+
super().__init__(message)
|
|
63
60
|
|
|
64
61
|
|
|
65
|
-
class CellMLParser
|
|
62
|
+
class CellMLParser:
|
|
66
63
|
"""
|
|
67
64
|
Parses CellML 2.0 documents, and performs (partial) validation.
|
|
68
65
|
|
|
@@ -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
|
|
@@ -27,7 +24,7 @@ def write_string(model):
|
|
|
27
24
|
return CellMLWriter().write_string(model)
|
|
28
25
|
|
|
29
26
|
|
|
30
|
-
class CellMLWriter
|
|
27
|
+
class CellMLWriter:
|
|
31
28
|
"""
|
|
32
29
|
Writes CellML 2.0 documents.
|
|
33
30
|
"""
|
|
@@ -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 ._importer import ChannelMLImporter, ChannelMLError # noqa
|
|
11
8
|
|
|
12
9
|
|
|
@@ -4,23 +4,13 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
7
|
+
import io
|
|
10
8
|
import os
|
|
11
9
|
import textwrap
|
|
10
|
+
import warnings
|
|
12
11
|
import xml.dom
|
|
13
12
|
import xml.dom.minidom
|
|
14
13
|
|
|
15
|
-
import warnings
|
|
16
|
-
|
|
17
|
-
try:
|
|
18
|
-
# Python 2
|
|
19
|
-
from cStringIO import StringIO
|
|
20
|
-
except ImportError:
|
|
21
|
-
# Python3
|
|
22
|
-
from io import StringIO
|
|
23
|
-
|
|
24
14
|
import myokit
|
|
25
15
|
from myokit import formats
|
|
26
16
|
from myokit import Name, Number, Minus, Multiply, Divide, Power
|
|
@@ -71,7 +61,7 @@ class ChannelMLImporter(formats.Importer):
|
|
|
71
61
|
from the ChannelML format.
|
|
72
62
|
"""
|
|
73
63
|
def __init__(self, verbose=False):
|
|
74
|
-
super(
|
|
64
|
+
super().__init__()
|
|
75
65
|
self.generated_name_index = 0
|
|
76
66
|
|
|
77
67
|
def component(self, path, model):
|
|
@@ -373,7 +363,7 @@ class ChannelMLImporter(formats.Importer):
|
|
|
373
363
|
if not root.hasAttribute('xmlns:meta'):
|
|
374
364
|
return None
|
|
375
365
|
ns = root.getAttribute('xmlns:meta')
|
|
376
|
-
b = StringIO()
|
|
366
|
+
b = io.StringIO()
|
|
377
367
|
|
|
378
368
|
def scan(parent):
|
|
379
369
|
kid = dom_child(parent)
|
myokit/formats/cpp/__init__.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.formats.ansic
|
|
8
|
+
|
|
11
9
|
from ._ewriter import CppExpressionWriter
|
|
12
10
|
|
|
13
11
|
|
myokit/formats/cpp/_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
|
from myokit.formats.ansic import AnsiCExpressionWriter
|
|
11
8
|
|
|
12
9
|
|
myokit/formats/cuda/__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 CudaKernelExporter, CudaKernelRLExporter
|
|
11
8
|
from ._ewriter import CudaExpressionWriter
|
|
12
9
|
from myokit.formats import ansic
|
myokit/formats/cuda/_ewriter.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.python import PythonExpressionWriter
|
|
12
10
|
|
|
13
11
|
|
|
@@ -17,7 +15,7 @@ class CudaExpressionWriter(PythonExpressionWriter):
|
|
|
17
15
|
Myokit :class:`expressions <myokit.Expression>` to their CUDA equivalents.
|
|
18
16
|
"""
|
|
19
17
|
def __init__(self, precision=myokit.SINGLE_PRECISION):
|
|
20
|
-
super(
|
|
18
|
+
super().__init__()
|
|
21
19
|
self._function_prefix = ''
|
|
22
20
|
self._sp = (precision == myokit.SINGLE_PRECISION)
|
|
23
21
|
|