From 64935e04f403c021ae8a1758f56af1d7722484d9 Mon Sep 17 00:00:00 2001 From: Dr Maurice Hendrix <52317399+MauriceHendrix@users.noreply.github.com> Date: Wed, 8 Dec 2021 14:22:04 +0000 Subject: [PATCH] Update _command_line_script.py (#219) Corrected a typo in command line argument `--skip-ingularity-fixes` renaming it to `--skip-singularity-fixes` --- RELEASE.md | 3 ++ chaste_codegen/_command_line_script.py | 4 +- .../data/tests/test_console_script_help.txt | 4 +- .../data/tests/test_console_script_usage.txt | 2 +- chaste_codegen/tests/test_console_script.py | 46 +++++++++---------- chaste_codegen/version.txt | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index c7dca631..0a065db3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,6 @@ +# Release 0.9.2 +- Corrected a typo in command line argument `--skip-ingularity-fixes` renaming it to `--skip-singularity-fixes` + # Release 0.9.1 - Added RushLarsen translators for allowing output as c code (`--rush-larsen-c`) and labview (`--rush-larsen-labview`), These are for people wanting to generate generic c or labview code when using chaste_codegen as a stand-alone utility and are not used by chaste diff --git a/chaste_codegen/_command_line_script.py b/chaste_codegen/_command_line_script.py index b715647a..a0a693a4 100644 --- a/chaste_codegen/_command_line_script.py +++ b/chaste_codegen/_command_line_script.py @@ -97,7 +97,7 @@ def process_command_line(): help='explicitly set the name of the generated class') group.add_argument('-q', '--quiet', action='store_true', default=False, help="quiet operation, don't print informational messages to screen") - group.add_argument('--skip-ingularity-fixes', action='store_true', default=False, + group.add_argument('--skip-singularity-fixes', action='store_true', default=False, help="skip singularity fixes in Goldman-Hodgkin-Katz (GHK) equations.") group = parser.add_argument_group('Chaste options', description='Options specific to Chaste code output') @@ -180,7 +180,7 @@ def process_command_line(): if not args.show_outputs: # Load model once, not once per translator, but only if we're actually generating code model = load_model_with_conversions(args.cellml_file, use_modifiers=args.modifiers, quiet=args.quiet, - skip_singularity_fixes=args.skip_ingularity_fixes, + skip_singularity_fixes=args.skip_singularity_fixes, skip_conversions=skip_conversion(args)) if len(translators) > 1 and skip_conversion(args): diff --git a/chaste_codegen/data/tests/test_console_script_help.txt b/chaste_codegen/data/tests/test_console_script_help.txt index 8a15d10e..5a232b82 100644 --- a/chaste_codegen/data/tests/test_console_script_help.txt +++ b/chaste_codegen/data/tests/test_console_script_help.txt @@ -3,7 +3,7 @@ usage: chaste_codegen [-h] [--version] [--normal] [--cvode] [--grl1] [--grl2] [--rush-larsen-labview] [--rush-larsen-c] [-j] [-o OUTFILE] [--output-dir OUTPUT_DIR] [--show-outputs] [-c CLS_NAME] - [-q] [--skip-ingularity-fixes] [-y] [--opt] [-m] + [-q] [--skip-singularity-fixes] [-y] [--opt] [-m] [--lookup-table min max step] [--use-model-factory] cellml_file @@ -56,7 +56,7 @@ Generated code options: -c CLS_NAME explicitly set the name of the generated class -q, --quiet quiet operation, don't print informational messages to screen - --skip-ingularity-fixes + --skip-singularity-fixes skip singularity fixes in Goldman-Hodgkin-Katz (GHK) equations. diff --git a/chaste_codegen/data/tests/test_console_script_usage.txt b/chaste_codegen/data/tests/test_console_script_usage.txt index ac7fe894..c4eda1dc 100644 --- a/chaste_codegen/data/tests/test_console_script_usage.txt +++ b/chaste_codegen/data/tests/test_console_script_usage.txt @@ -3,7 +3,7 @@ usage: chaste_codegen [-h] [--version] [--normal] [--cvode] [--grl1] [--grl2] [--rush-larsen-labview] [--rush-larsen-c] [-j] [-o OUTFILE] [--output-dir OUTPUT_DIR] [--show-outputs] [-c CLS_NAME] - [-q] [--skip-ingularity-fixes] [-y] [--opt] [-m] + [-q] [--skip-singularity-fixes] [-y] [--opt] [-m] [--lookup-table min max step] [--use-model-factory] cellml_file diff --git a/chaste_codegen/tests/test_console_script.py b/chaste_codegen/tests/test_console_script.py index d5d39522..5da98e12 100644 --- a/chaste_codegen/tests/test_console_script.py +++ b/chaste_codegen/tests/test_console_script.py @@ -146,7 +146,7 @@ def test_script_convert(caplog, tmp_path): target = os.path.join(tmp_path, model_name + '.cellml') shutil.copyfile(model_file, target) - testargs = ['chaste_codegen', '--skip-ingularity-fixes', target] + testargs = ['chaste_codegen', '--skip-singularity-fixes', target] # Call commandline script with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -170,7 +170,7 @@ def test_script_convert_quiet(caplog, tmp_path): target = os.path.join(tmp_path, model_name + '.cellml') shutil.copyfile(model_file, target) - testargs = ['chaste_codegen', '--skip-ingularity-fixes', target, '--quiet'] + testargs = ['chaste_codegen', '--skip-singularity-fixes', target, '--quiet'] # Call commandline script with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -223,7 +223,7 @@ def test_script_double_type(tmp_path): target = os.path.join(tmp_path, model_name + '.cellml') shutil.copyfile(model_file, target) - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', '--cvode-data-clamp', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', '--cvode-data-clamp', '--backward-euler', target] # Call commandline script with mock.patch.object(sys, 'argv', testargs): @@ -251,7 +251,7 @@ def test_script_data_clamp_opt(tmp_path): target = os.path.join(tmp_path, model_name + '.cellml') shutil.copyfile(model_file, target) - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', '--cvode-data-clamp', '--opt', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', '--cvode-data-clamp', '--opt', target] # Call commandline script with mock.patch.object(sys, 'argv', testargs): @@ -283,7 +283,7 @@ def test_script_class_convtype_output_dll_loadable(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'output_class.c') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '-c', 'Chaste_CG', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '-c', 'Chaste_CG', '--normal', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -307,7 +307,7 @@ def test_script_opt_dynamic(tmp_path): shutil.copyfile(model_file, target) # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', target, '--normal', '--opt', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', target, '--normal', '--opt', '--dynamically-loadable', '--use-modifiers'] with mock.patch.object(sys, 'argv', testargs): @@ -333,7 +333,7 @@ def test_script_opt(tmp_path): shutil.copyfile(model_file, target) # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', target, '--normal', '--opt', '--use-modifiers'] + testargs = ['chaste_codegen', '--skip-singularity-fixes', target, '--normal', '--opt', '--use-modifiers'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -359,7 +359,7 @@ def test_script_cvode_opt(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_aslanidi_Purkinje_model_2009.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--cvode', '--opt', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--cvode', '--opt', '-o', outfile, '--dynamically-loadable', '--use-modifiers'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -380,7 +380,7 @@ def test_script_cvode(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_mahajan_shiferaw_2008.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--cvode', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--cvode', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -401,7 +401,7 @@ def test_script_cvode_jacobian(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_Shannon2004.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--cvode', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--cvode', '-o', outfile, '--use-analytic-jacobian', '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -422,7 +422,7 @@ def test_script_dynamic_BE(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_courtemanche_ramirez_nattel_1998.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--backward-euler', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--backward-euler', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -443,7 +443,7 @@ def test_script_dynamic_BEopt(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_courtemanche_ramirez_nattel_1998.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--backward-euler', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--backward-euler', '--opt', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -464,7 +464,7 @@ def test_script_dynamic_RL(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_livshitz_rudy_2007.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--rush-larsen', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--rush-larsen', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -485,7 +485,7 @@ def test_script_RLopt(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_bondarenko_szigeti_bett_kim_rasmusson_2004_apical.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--rush-larsen', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--rush-larsen', '--opt', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -510,7 +510,7 @@ def test_script_GRL1(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_demir_model_1994.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--grl1', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--grl1', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -531,7 +531,7 @@ def test_script_GRL1Opt(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_matsuoka_model_2003.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--grl1', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--grl1', '--opt', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -552,7 +552,7 @@ def test_script_GRL2(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_winslow_model_1999.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--grl2', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--grl2', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -573,7 +573,7 @@ def test_script_GRL2Opt(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_viswanathan_model_1999_epi.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--grl2', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--grl2', '--opt', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -594,7 +594,7 @@ def test_script_CVODE_DATA_CLAMP(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'dynamic_Shannon2004.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--cvode-data-clamp', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--cvode-data-clamp', '-o', outfile, '--dynamically-loadable'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -615,7 +615,7 @@ def test_script_CVODE_DATA_CLAMP_modifiers(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'Shannon2004_with_modifiers.cpp') # Call commandline script - testargs = ['chaste_codegen', '--use-model-factory', '--skip-ingularity-fixes', model_file, '--cvode-data-clamp', + testargs = ['chaste_codegen', '--use-model-factory', '--skip-singularity-fixes', model_file, '--cvode-data-clamp', '-o', outfile, '--use-modifiers'] with mock.patch.object(sys, 'argv', testargs): chaste_codegen() @@ -636,7 +636,7 @@ def test_script_lookup_table(tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'beeler_reuter_model_1977_lookup_tables.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--opt', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--opt', '-o', outfile, '--lookup-table', 'membrane_voltage', '-150.0001', '199.9999', '0.01', '--lookup-table', 'cytosolic_calcium_concentration', '0.00001', '30.00001', '0.0001'] @@ -693,7 +693,7 @@ def test_script_lookup_table_wrong_args2(caplog): assert os.path.isfile(model_file) outfile = 'beeler_reuter_model_1977_lookup_tables.cpp' # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--opt', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--opt', '-o', outfile, '--lookup-table', 'membrane_voltage', 'membrane_voltage', '199.9999', '0.01'] with mock.patch.object(sys, 'argv', testargs): @@ -711,7 +711,7 @@ def test_script_lookup_table_check_non_existing_tag_ignored(caplog, tmp_path): assert os.path.isfile(model_file) outfile = os.path.join(tmp_path, 'beeler_reuter_model_1977_lookup_tables.cpp') # Call commandline script - testargs = ['chaste_codegen', '--skip-ingularity-fixes', model_file, '--opt', '-o', outfile, + testargs = ['chaste_codegen', '--skip-singularity-fixes', model_file, '--opt', '-o', outfile, '--lookup-table', 'membrane_voltage', '-150.0001', '199.9999', '0.01', '--lookup-table', 'cytosolic_calcium_concentration', '0.00001', '30.00001', '0.0001', '--lookup-table', 'non_existing_tag', '-150.0001', '199.9999', '0.01'] diff --git a/chaste_codegen/version.txt b/chaste_codegen/version.txt index f374f666..2003b639 100644 --- a/chaste_codegen/version.txt +++ b/chaste_codegen/version.txt @@ -1 +1 @@ -0.9.1 +0.9.2