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()