From 3205327440a9cf61d73e446bb9ce7f444b7d92da Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Tue, 9 Jul 2024 23:45:20 +0100 Subject: [PATCH 1/7] Add python 3.12 to tests --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ccf4c5de..6bd08513 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout repository and submodules uses: actions/checkout@v4 From 70dff316d26aa597e169393a0c638953a789168d Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 05:01:57 +0100 Subject: [PATCH 2/7] #281 Add pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..fed528d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" From ec8ea9ef6e8427a0c6c56851dc2b01e8522a9eae Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 05:02:49 +0100 Subject: [PATCH 3/7] #281 Update dependency versions --- setup.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index e1b9cfa1..7a3cb58e 100644 --- a/setup.py +++ b/setup.py @@ -47,21 +47,21 @@ # List of dependencies install_requires=[ 'py>=1.10.0', - 'decorator>=4.4.2, <5', - 'importlib-metadata>=1.7, <5', + 'decorator>=4.4.2, <6', + 'importlib-metadata>=1.7, <8', 'isodate>=0.6.0, <1', - 'lxml>=4.6.5, <5', - 'MarkupSafe>=1.1.1, <2', + 'lxml>=4.6.5, <6', + 'MarkupSafe>=1.1.1, <3', 'mpmath>=1.1.0, <2', - 'networkx>=2.4, <3', - 'packaging>=20.4, <21', - 'Pint>=0.9, <0.20', - 'pyparsing>=2.4.7, <3', - 'rdflib>=5.0.0, <7', + 'networkx>=2.4, <4', + 'packaging>=20.4, <24', + 'Pint>=0.9, <0.30', + 'pyparsing>=2.4.7, <4', + 'rdflib>=5.0.0, <8', 'six>=1.15.0, <2', 'sympy>=1.9, <1.11', - 'zipp>=1.2.0, <2', - 'Jinja2>=2.11.3, <4', + 'zipp>=1.2.0, <4', + 'Jinja2>=3.0.0, <4', 'cellmlmanip>=0.3.6, <0.4', 'Jinja2>=2.11.3, <4', ], From 3d5414b2af366ecfe56a6af7e13c469ef74ccc93 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 05:08:19 +0100 Subject: [PATCH 4/7] #281 Switch from OrderedDict to dict --- chaste_codegen/_command_line_script.py | 5 ++--- chaste_codegen/_lookup_tables.py | 4 +--- chaste_codegen/data/tests/test_jacobian_equations_2.txt | 2 +- .../data/tests/test_jacobian_equations_2.txt_python36 | 2 +- chaste_codegen/data/tests/test_jacobian_matrix_2.txt | 2 +- .../data/tests/test_jacobian_matrix_2.txt_python36 | 2 +- chaste_codegen/tests/test_jacobian.py | 5 ++--- 7 files changed, 9 insertions(+), 13 deletions(-) diff --git a/chaste_codegen/_command_line_script.py b/chaste_codegen/_command_line_script.py index f70fb6d9..4c515e90 100644 --- a/chaste_codegen/_command_line_script.py +++ b/chaste_codegen/_command_line_script.py @@ -3,7 +3,6 @@ ###################################################################### import argparse import os -from collections import OrderedDict import chaste_codegen as cg from chaste_codegen import LOGGER, CodegenError, load_model_with_conversions @@ -17,7 +16,7 @@ # pass -- to select this model type -TRANSLATORS = OrderedDict( +TRANSLATORS = dict( [('normal', (cg.NormalChasteModel, 'FromCellML', '', True, '')), ('cvode', (cg.CvodeChasteModel, 'FromCellMLCvode', 'Cvode', True, '')), ('cvode-data-clamp', (cg.CvodeChasteModel, 'FromCellMLCvodeDataClamp', 'CvodeDataClamp', True, '')), @@ -29,7 +28,7 @@ ' in mastrcriptRT with added injection current(i_inj)')), ('rush-larsen-c', (cg.RushLarsenC, '', '', False, ' in C with added injection current(i_inj)'))]) -TRANSLATORS_OPT = OrderedDict( +TRANSLATORS_OPT = dict( [('normal', (cg.OptChasteModel, 'FromCellMLOpt', 'Opt', True, '')), ('cvode', (cg.OptCvodeChasteModel, 'FromCellMLCvodeOpt', 'CvodeOpt', True, '')), ('cvode-data-clamp', (cg.OptCvodeChasteModel, 'FromCellMLCvodeDataClampOpt', 'CvodeDataClampOpt', True, '')), diff --git a/chaste_codegen/_lookup_tables.py b/chaste_codegen/_lookup_tables.py index 852d29ec..5777bbc8 100644 --- a/chaste_codegen/_lookup_tables.py +++ b/chaste_codegen/_lookup_tables.py @@ -1,5 +1,3 @@ -import collections - from cellmlmanip.model import Quantity, Variable from sympy import ( Piecewise, @@ -71,7 +69,7 @@ def __init__(self, model, lookup_params=DEFAULT_LOOKUP_PARAMETERS): 'lookup_epxrs': []} for param in lookup_params) self._model = model self._lookup_variables = set() - self._lookup_table_expr = collections.OrderedDict() + self._lookup_table_expr = dict() self._lookup_params_processed, self._lookup_params_printed = False, False self._method_printed = None diff --git a/chaste_codegen/data/tests/test_jacobian_equations_2.txt b/chaste_codegen/data/tests/test_jacobian_equations_2.txt index 4b2ba638..2bd7dc2f 100644 --- a/chaste_codegen/data/tests/test_jacobian_equations_2.txt +++ b/chaste_codegen/data/tests/test_jacobian_equations_2.txt @@ -1 +1 @@ -[OrderedDict([('lhs', 'x0'), ('rhs', 'x0120.0*_sodium_channel_m_gate$m**3.0'), ('sympy_lhs', x0)]), OrderedDict([('lhs', 'x1'), ('rhs', 'x1_membrane$V - 40.0'), ('sympy_lhs', x1)]), OrderedDict([('lhs', 'x4'), ('rhs', 'x4(0.10000000000000001*_membrane$V + 5.0000000000000003 >= -9.9999999999999995e-8) & (0.10000000000000001*_membrane$V + 5.0000000000000003 <= 9.9999999999999995e-8)'), ('sympy_lhs', x4)]), OrderedDict([('lhs', 'x5'), ('rhs', 'x5exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003)'), ('sympy_lhs', x5)]), OrderedDict([('lhs', 'x6'), ('rhs', 'x6exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0'), ('sympy_lhs', x6)]), OrderedDict([('lhs', 'x7'), ('rhs', 'x71/(exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0)'), ('sympy_lhs', x7)]), OrderedDict([('lhs', 'x8'), ('rhs', 'x8exp_(-0.055555555555555556*_membrane$V - 4.1666666666666667)'), ('sympy_lhs', x8)]), OrderedDict([('lhs', 'x9'), ('rhs', 'x9exp_(-0.05*_membrane$V - 3.75)'), ('sympy_lhs', x9)]), OrderedDict([('lhs', 'x10'), ('rhs', 'x10exp_(-0.1*_membrane$V - 4.5)'), ('sympy_lhs', x10)]), OrderedDict([('lhs', 'x11'), ('rhs', 'x11exp_(-0.1*_membrane$V - 4.5) + 1.0'), ('sympy_lhs', x11)]), OrderedDict([('lhs', 'x12'), ('rhs', 'x120.10000000000000001*_membrane$V + 6.5000000000000004'), ('sympy_lhs', x12)]), OrderedDict([('lhs', 'x13'), ('rhs', 'x13(0.10000000000000001*_membrane$V + 6.5000000000000004 >= -9.9999999999999995e-8) & (0.10000000000000001*_membrane$V + 6.5000000000000004 <= 9.9999999999999995e-8)'), ('sympy_lhs', x13)]), OrderedDict([('lhs', 'x14'), ('rhs', 'x14exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004)'), ('sympy_lhs', x14)]), OrderedDict([('lhs', 'x15'), ('rhs', 'x15exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0'), ('sympy_lhs', x15)]), OrderedDict([('lhs', 'x16'), ('rhs', 'x161/(exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0)'), ('sympy_lhs', x16)]), OrderedDict([('lhs', 'x17'), ('rhs', 'x17exp_(0.0125*_membrane$V + 0.9375)'), ('sympy_lhs', x17)])] \ No newline at end of file +[{'lhs': 'x0', 'rhs': 'x0120.0*_sodium_channel_m_gate$m**3.0', 'sympy_lhs': x0}, {'lhs': 'x1', 'rhs': 'x1_membrane$V - 40.0', 'sympy_lhs': x1}, {'lhs': 'x4', 'rhs': 'x4(0.10000000000000001*_membrane$V + 5.0000000000000003 >= -9.9999999999999995e-8) & (0.10000000000000001*_membrane$V + 5.0000000000000003 <= 9.9999999999999995e-8)', 'sympy_lhs': x4}, {'lhs': 'x5', 'rhs': 'x5exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003)', 'sympy_lhs': x5}, {'lhs': 'x6', 'rhs': 'x6exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0', 'sympy_lhs': x6}, {'lhs': 'x7', 'rhs': 'x71/(exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0)', 'sympy_lhs': x7}, {'lhs': 'x8', 'rhs': 'x8exp_(-0.055555555555555556*_membrane$V - 4.1666666666666667)', 'sympy_lhs': x8}, {'lhs': 'x9', 'rhs': 'x9exp_(-0.05*_membrane$V - 3.75)', 'sympy_lhs': x9}, {'lhs': 'x10', 'rhs': 'x10exp_(-0.1*_membrane$V - 4.5)', 'sympy_lhs': x10}, {'lhs': 'x11', 'rhs': 'x11exp_(-0.1*_membrane$V - 4.5) + 1.0', 'sympy_lhs': x11}, {'lhs': 'x12', 'rhs': 'x120.10000000000000001*_membrane$V + 6.5000000000000004', 'sympy_lhs': x12}, {'lhs': 'x13', 'rhs': 'x13(0.10000000000000001*_membrane$V + 6.5000000000000004 >= -9.9999999999999995e-8) & (0.10000000000000001*_membrane$V + 6.5000000000000004 <= 9.9999999999999995e-8)', 'sympy_lhs': x13}, {'lhs': 'x14', 'rhs': 'x14exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004)', 'sympy_lhs': x14}, {'lhs': 'x15', 'rhs': 'x15exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0', 'sympy_lhs': x15}, {'lhs': 'x16', 'rhs': 'x161/(exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0)', 'sympy_lhs': x16}, {'lhs': 'x17', 'rhs': 'x17exp_(0.0125*_membrane$V + 0.9375)', 'sympy_lhs': x17}] \ No newline at end of file diff --git a/chaste_codegen/data/tests/test_jacobian_equations_2.txt_python36 b/chaste_codegen/data/tests/test_jacobian_equations_2.txt_python36 index 56c9658b..8ce18d06 100644 --- a/chaste_codegen/data/tests/test_jacobian_equations_2.txt_python36 +++ b/chaste_codegen/data/tests/test_jacobian_equations_2.txt_python36 @@ -1 +1 @@ -[OrderedDict([('lhs', 'x0'), ('rhs', 'x0120.0*_sodium_channel_m_gate$m**3.0'), ('sympy_lhs', x0)]), OrderedDict([('lhs', 'x1'), ('rhs', 'x1_membrane$V - 40.0'), ('sympy_lhs', x1)]), OrderedDict([('lhs', 'x2'), ('rhs', 'x2(_membrane$V >= -50.000001) & (_membrane$V <= -49.999999)'), ('sympy_lhs', x2)]), OrderedDict([('lhs', 'x4'), ('rhs', 'x4-0.10000000000000001*_membrane$V - 5.0000000000000003'), ('sympy_lhs', x4)]), OrderedDict([('lhs', 'x5'), ('rhs', 'x5exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003)'), ('sympy_lhs', x5)]), OrderedDict([('lhs', 'x6'), ('rhs', 'x6exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0'), ('sympy_lhs', x6)]), OrderedDict([('lhs', 'x7'), ('rhs', 'x71/(exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0)'), ('sympy_lhs', x7)]), OrderedDict([('lhs', 'x8'), ('rhs', 'x8exp_(-0.055555555555555556*_membrane$V - 4.1666666666666667)'), ('sympy_lhs', x8)]), OrderedDict([('lhs', 'x9'), ('rhs', 'x9exp_(-0.05*_membrane$V - 3.75)'), ('sympy_lhs', x9)]), OrderedDict([('lhs', 'x10'), ('rhs', 'x10exp_(-0.1*_membrane$V - 4.5)'), ('sympy_lhs', x10)]), OrderedDict([('lhs', 'x11'), ('rhs', 'x11exp_(-0.1*_membrane$V - 4.5) + 1.0'), ('sympy_lhs', x11)]), OrderedDict([('lhs', 'x12'), ('rhs', 'x12(_membrane$V >= -65.000001) & (_membrane$V <= -64.999999)'), ('sympy_lhs', x12)]), OrderedDict([('lhs', 'x13'), ('rhs', 'x13-0.10000000000000001*_membrane$V - 6.5000000000000004'), ('sympy_lhs', x13)]), OrderedDict([('lhs', 'x14'), ('rhs', 'x14exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004)'), ('sympy_lhs', x14)]), OrderedDict([('lhs', 'x15'), ('rhs', 'x15exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0'), ('sympy_lhs', x15)]), OrderedDict([('lhs', 'x16'), ('rhs', 'x161/(exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0)'), ('sympy_lhs', x16)]), OrderedDict([('lhs', 'x17'), ('rhs', 'x17exp_(0.0125*_membrane$V + 0.9375)'), ('sympy_lhs', x17)])] \ No newline at end of file +[{'lhs': 'x0', 'rhs': 'x0120.0*_sodium_channel_m_gate$m**3.0', 'sympy_lhs': x0}, {'lhs': 'x1', 'rhs': 'x1_membrane$V - 40.0', 'sympy_lhs': x1}, {'lhs': 'x2', 'rhs': 'x2(_membrane$V >= -50.000001) & (_membrane$V <= -49.999999)', 'sympy_lhs': x2}, {'lhs': 'x4', 'rhs': 'x4-0.10000000000000001*_membrane$V - 5.0000000000000003', 'sympy_lhs': x4}, {'lhs': 'x5', 'rhs': 'x5exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003)', 'sympy_lhs': x5}, {'lhs': 'x6', 'rhs': 'x6exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0', 'sympy_lhs': x6}, {'lhs': 'x7', 'rhs': 'x71/(exp_(-0.10000000000000001*_membrane$V - 5.0000000000000003) - 1.0)', 'sympy_lhs': x7}, {'lhs': 'x8', 'rhs': 'x8exp_(-0.055555555555555556*_membrane$V - 4.1666666666666667)', 'sympy_lhs': x8}, {'lhs': 'x9', 'rhs': 'x9exp_(-0.05*_membrane$V - 3.75)', 'sympy_lhs': x9}, {'lhs': 'x10', 'rhs': 'x10exp_(-0.1*_membrane$V - 4.5)', 'sympy_lhs': x10}, {'lhs': 'x11', 'rhs': 'x11exp_(-0.1*_membrane$V - 4.5) + 1.0', 'sympy_lhs': x11}, {'lhs': 'x12', 'rhs': 'x12(_membrane$V >= -65.000001) & (_membrane$V <= -64.999999)', 'sympy_lhs': x12}, {'lhs': 'x13', 'rhs': 'x13-0.10000000000000001*_membrane$V - 6.5000000000000004', 'sympy_lhs': x13}, {'lhs': 'x14', 'rhs': 'x14exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004)', 'sympy_lhs': x14}, {'lhs': 'x15', 'rhs': 'x15exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0', 'sympy_lhs': x15}, {'lhs': 'x16', 'rhs': 'x161/(exp_(-0.10000000000000001*_membrane$V - 6.5000000000000004) - 1.0)', 'sympy_lhs': x16}, {'lhs': 'x17', 'rhs': 'x17exp_(0.0125*_membrane$V + 0.9375)', 'sympy_lhs': x17}] \ No newline at end of file diff --git a/chaste_codegen/data/tests/test_jacobian_matrix_2.txt b/chaste_codegen/data/tests/test_jacobian_matrix_2.txt index f532b494..8f824f21 100644 --- a/chaste_codegen/data/tests/test_jacobian_matrix_2.txt +++ b/chaste_codegen/data/tests/test_jacobian_matrix_2.txt @@ -1 +1 @@ -[OrderedDict([('i', 0), ('j', 0), ('entry', '-0.29999999999999999 - 36 * pow(potassium_channel_n_gate$n, 4) - x0 * sodium_channel_h_gate$h')]), OrderedDict([('i', 1), ('j', 0), ('entry', '(1 - sodium_channel_m_gate$m) * ((x4) ? (0.050000000000000003) : (-0.10000000000000001 * x7 - 0.10000000000000001 * x3 * x5 / pow(x6, 2))) + 0.22222222222222221 * x8 * sodium_channel_m_gate$m')]), OrderedDict([('i', 2), ('j', 0), ('entry', '-0.050000000000000003 * x9 * (0.070000000000000007 - 0.070000000000000007 * sodium_channel_h_gate$h) - 0.10000000000000001 * x10 * sodium_channel_h_gate$h / pow(x11, 2)')]), OrderedDict([('i', 3), ('j', 0), ('entry', '(1 - potassium_channel_n_gate$n) * ((x13) ? (0.0050000000000000001) : (-0.01 * x16 - 0.01 * x12 * x14 / pow(x15, 2))) - 0.0015625000000000001 * x17 * potassium_channel_n_gate$n')]), OrderedDict([('i', 0), ('j', 1), ('entry', '-360 * x1 * pow(sodium_channel_m_gate$m, 2) * sodium_channel_h_gate$h')]), OrderedDict([('i', 1), ('j', 1), ('entry', '-((x4) ? (3.5 + 0.050000000000000003 * membrane$V) : (-x3 * x7)) - 4 * x8')]), OrderedDict([('i', 0), ('j', 2), ('entry', '-x0 * x1')]), OrderedDict([('i', 2), ('j', 2), ('entry', '-1 / x11 - 0.070000000000000007 * x9')]), OrderedDict([('i', 0), ('j', 3), ('entry', '-144 * pow(potassium_channel_n_gate$n, 3) * (87 + membrane$V)')]), OrderedDict([('i', 3), ('j', 3), ('entry', '-((x13) ? (0.42499999999999999 + 0.0050000000000000001 * membrane$V) : (-0.099999999999999992 * x12 * x16)) - 0.125 * x17')])] \ No newline at end of file +[{'i': 0, 'j': 0, 'entry': '-0.29999999999999999 - 36 * pow(potassium_channel_n_gate$n, 4) - x0 * sodium_channel_h_gate$h'}, {'i': 1, 'j': 0, 'entry': '(1 - sodium_channel_m_gate$m) * ((x4) ? (0.050000000000000003) : (-0.10000000000000001 * x7 - 0.10000000000000001 * x3 * x5 / pow(x6, 2))) + 0.22222222222222221 * x8 * sodium_channel_m_gate$m'}, {'i': 2, 'j': 0, 'entry': '-0.050000000000000003 * x9 * (0.070000000000000007 - 0.070000000000000007 * sodium_channel_h_gate$h) - 0.10000000000000001 * x10 * sodium_channel_h_gate$h / pow(x11, 2)'}, {'i': 3, 'j': 0, 'entry': '(1 - potassium_channel_n_gate$n) * ((x13) ? (0.0050000000000000001) : (-0.01 * x16 - 0.01 * x12 * x14 / pow(x15, 2))) - 0.0015625000000000001 * x17 * potassium_channel_n_gate$n'}, {'i': 0, 'j': 1, 'entry': '-360 * x1 * pow(sodium_channel_m_gate$m, 2) * sodium_channel_h_gate$h'}, {'i': 1, 'j': 1, 'entry': '-((x4) ? (3.5 + 0.050000000000000003 * membrane$V) : (-x3 * x7)) - 4 * x8'}, {'i': 0, 'j': 2, 'entry': '-x0 * x1'}, {'i': 2, 'j': 2, 'entry': '-1 / x11 - 0.070000000000000007 * x9'}, {'i': 0, 'j': 3, 'entry': '-144 * pow(potassium_channel_n_gate$n, 3) * (87 + membrane$V)'}, {'i': 3, 'j': 3, 'entry': '-((x13) ? (0.42499999999999999 + 0.0050000000000000001 * membrane$V) : (-0.099999999999999992 * x12 * x16)) - 0.125 * x17'}] \ No newline at end of file diff --git a/chaste_codegen/data/tests/test_jacobian_matrix_2.txt_python36 b/chaste_codegen/data/tests/test_jacobian_matrix_2.txt_python36 index e8a06f18..5c141c27 100644 --- a/chaste_codegen/data/tests/test_jacobian_matrix_2.txt_python36 +++ b/chaste_codegen/data/tests/test_jacobian_matrix_2.txt_python36 @@ -1 +1 @@ -[OrderedDict([('i', 0), ('j', 0), ('entry', '-0.29999999999999999 - 36 * pow(potassium_channel_n_gate$n, 4) - x0 * sodium_channel_h_gate$h')]), OrderedDict([('i', 1), ('j', 0), ('entry', '(1 - sodium_channel_m_gate$m) * ((x2) ? (0.050000000000000003) : (-0.10000000000000001 * x7 + 0.10000000000000001 * x4 * x5 / pow(x6, 2))) + 0.22222222222222221 * x8 * sodium_channel_m_gate$m')]), OrderedDict([('i', 2), ('j', 0), ('entry', '-0.050000000000000003 * x9 * (0.070000000000000007 - 0.070000000000000007 * sodium_channel_h_gate$h) - 0.10000000000000001 * x10 * sodium_channel_h_gate$h / pow(x11, 2)')]), OrderedDict([('i', 3), ('j', 0), ('entry', '(1 - potassium_channel_n_gate$n) * ((x12) ? (0.0050000000000000001) : (-0.01 * x16 + 0.01 * x13 * x14 / pow(x15, 2))) - 0.0015625000000000001 * x17 * potassium_channel_n_gate$n')]), OrderedDict([('i', 0), ('j', 1), ('entry', '-360 * x1 * pow(sodium_channel_m_gate$m, 2) * sodium_channel_h_gate$h')]), OrderedDict([('i', 1), ('j', 1), ('entry', '-((x2) ? (3.5 + 0.050000000000000003 * membrane$V) : (x4 * x7)) - 4 * x8')]), OrderedDict([('i', 0), ('j', 2), ('entry', '-x0 * x1')]), OrderedDict([('i', 2), ('j', 2), ('entry', '-1 / x11 - 0.070000000000000007 * x9')]), OrderedDict([('i', 0), ('j', 3), ('entry', '-144 * pow(potassium_channel_n_gate$n, 3) * (87 + membrane$V)')]), OrderedDict([('i', 3), ('j', 3), ('entry', '-((x12) ? (0.42499999999999999 + 0.0050000000000000001 * membrane$V) : (0.099999999999999992 * x13 * x16)) - 0.125 * x17')])] \ No newline at end of file +[{'i': 0, 'j': 0, 'entry': '-0.29999999999999999 - 36 * pow(potassium_channel_n_gate$n, 4) - x0 * sodium_channel_h_gate$h'}, {'i': 1, 'j': 0, 'entry': '(1 - sodium_channel_m_gate$m) * ((x2) ? (0.050000000000000003) : (-0.10000000000000001 * x7 + 0.10000000000000001 * x4 * x5 / pow(x6, 2))) + 0.22222222222222221 * x8 * sodium_channel_m_gate$m'}, {'i': 2, 'j': 0, 'entry': '-0.050000000000000003 * x9 * (0.070000000000000007 - 0.070000000000000007 * sodium_channel_h_gate$h) - 0.10000000000000001 * x10 * sodium_channel_h_gate$h / pow(x11, 2)'}, {'i': 3, 'j': 0, 'entry': '(1 - potassium_channel_n_gate$n) * ((x12) ? (0.0050000000000000001) : (-0.01 * x16 + 0.01 * x13 * x14 / pow(x15, 2))) - 0.0015625000000000001 * x17 * potassium_channel_n_gate$n'}, {'i': 0, 'j': 1, 'entry': '-360 * x1 * pow(sodium_channel_m_gate$m, 2) * sodium_channel_h_gate$h'}, {'i': 1, 'j': 1, 'entry': '-((x2) ? (3.5 + 0.050000000000000003 * membrane$V) : (x4 * x7)) - 4 * x8'}, {'i': 0, 'j': 2, 'entry': '-x0 * x1'}, {'i': 2, 'j': 2, 'entry': '-1 / x11 - 0.070000000000000007 * x9'}, {'i': 0, 'j': 3, 'entry': '-144 * pow(potassium_channel_n_gate$n, 3) * (87 + membrane$V)'}, {'i': 3, 'j': 3, 'entry': '-((x12) ? (0.42499999999999999 + 0.0050000000000000001 * membrane$V) : (0.099999999999999992 * x13 * x16)) - 0.125 * x17'}] \ No newline at end of file diff --git a/chaste_codegen/tests/test_jacobian.py b/chaste_codegen/tests/test_jacobian.py index 3bc5fe8d..74c0bbb2 100644 --- a/chaste_codegen/tests/test_jacobian.py +++ b/chaste_codegen/tests/test_jacobian.py @@ -1,4 +1,3 @@ -import collections import os import pytest @@ -91,10 +90,10 @@ def test_format_jacobian(jacobian): equations, jacobian = format_jacobian(jacobian_equations, sp.Matrix([jacobian_matrix]), ChastePrinter(), lambda x, y: str(x) + str(y)) # order dictionary for printing - equations = [collections.OrderedDict([('lhs', eq['lhs']), ('rhs', eq['rhs']), ('sympy_lhs', eq['sympy_lhs'])]) + equations = [dict([('lhs', eq['lhs']), ('rhs', eq['rhs']), ('sympy_lhs', eq['sympy_lhs'])]) for eq in equations] # order dictionary for printing - jacobian = [collections.OrderedDict([('i', jac['i']), ('j', jac['j']), ('entry', jac['entry'])]) + jacobian = [dict([('i', jac['i']), ('j', jac['j']), ('entry', jac['entry'])]) for jac in jacobian] expected = open(os.path.join(TESTS_FOLDER, 'test_jacobian_equations_2.txt'), 'r').read() From 003de78dca9fb63da75dba842a0b4cd5278a7f6d Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 08:38:28 +0100 Subject: [PATCH 5/7] #281 Increasee version to 0.10.4 --- RELEASE.md | 16 ++++++++++++++++ chaste_codegen/version.txt | 2 +- setup.py | 1 - 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index bd3d188e..25be5929 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,19 @@ +# Release 0.10.5 +- Added support for Python 3.12. +- Updated dependency versions: + - decorator>=4.4.2, <6 + - importlib-metadata>=1.7, <8 + - lxml>=4.6.5, <6 + - MarkupSafe>=1.1.1, <3 + - mpmath>=1.1.0, <2 + - networkx>=2.4, <4 + - packaging>=20.4, <24 + - Pint>=0.9, <0.30 + - pyparsing>=2.4.7, <4 + - rdflib>=5.0.0, <8 + - zipp>=1.2.0, <4 + - Jinja2>=3.0.0, <4 + # Release 0.10.4 - Improved the developer documentation with regards to updating python packages, the ontology and releasing new versions of chaste_codegen. diff --git a/chaste_codegen/version.txt b/chaste_codegen/version.txt index a3f5a8ed..9b40aa6c 100644 --- a/chaste_codegen/version.txt +++ b/chaste_codegen/version.txt @@ -1 +1 @@ -0.10.3 +0.10.4 diff --git a/setup.py b/setup.py index 7a3cb58e..f21cba50 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,6 @@ 'zipp>=1.2.0, <4', 'Jinja2>=3.0.0, <4', 'cellmlmanip>=0.3.6, <0.4', - 'Jinja2>=2.11.3, <4', ], extras_require={ 'docs': [ From de41094da675df017ec4c02741a4405a4a8cd1a5 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 08:40:58 +0100 Subject: [PATCH 6/7] #281 Increment to version 0.10.5 --- chaste_codegen/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaste_codegen/version.txt b/chaste_codegen/version.txt index 9b40aa6c..9028ec63 100644 --- a/chaste_codegen/version.txt +++ b/chaste_codegen/version.txt @@ -1 +1 @@ -0.10.4 +0.10.5 From e00ba4aaeb51fa39c5c0c1987ff06cfe66642d90 Mon Sep 17 00:00:00 2001 From: Kwabena N Amponsah Date: Mon, 30 Sep 2024 11:18:09 +0100 Subject: [PATCH 7/7] #281 Update readthedocs config --- .readthedocs.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index e3023e3b..85e96429 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,23 +5,26 @@ # Required version: 2 +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF +# Optionally build your docs in additional formats such as PDF and ePub formats: - pdf -# Optionally set the version of Python and requirements required to build your docs +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: - version: 3.7 install: - method: pip path: . extra_requirements: - - docs \ No newline at end of file + - docs