Generate carputils script from openCARP parameter file
What does this MR do?
Adds a script allowing to generate a carputils script from an openCARP parameter file.
By default, the script copies all parameters from the parameter file in a carputils script. If a simID is provided in the file, it is passed to the carputils jobID function.
$ parfile2carputils --help
usage:
@package bin.parfile2carputils
Generate a basic carputils workflow from an openCARP parameter file.
The resulting carputils script is independent from the input parameter file, unless the option --keep-parfile is set.
Example of usage:
$ parfile2carputils example.par
--- Generates a carputils script named run.py from the openCARP parameter file example.par.
$ parfile2carputils example.par --output run_example.py --overwrite
--- Generates a carputils script named run_example.py from the openCARP parameter file example.par,
overwriting the output file if it already exists.
$ parfile2carputils ../example.par --keep-parfile
--- Generates a carputils script named run.py from the openCARP parameter file ../example.par, copying the
parameter file in the current working directory, and using it as an input parameter file in the script.
In the end, the current directory will contain a copy of the parameter file and the generated script.
[-h] [--output OUTPUT] [--overwrite] [--keep-parfile] [--overwrite-parfile] [--author AUTHOR] parfile
positional arguments:
parfile openCARP parameter file to read
options:
-h, --help show this help message and exit
--output OUTPUT output file name
--overwrite Overwrite the output file if it already exists. By default, the file is not overwritten.
--keep-parfile Copy the input parameter file in the output directory and read parameters from it in the generated script
--overwrite-parfile Overwrite the parameter file in the output directory if it already exists. By default, the file is not overwritten. This option is only relevant if --keep-parfile is set.
--author AUTHOR Author name to include in the generated script
Author's checklist
-
Follow the Contribution Guidelines. -
Apply the appropriate labels. -
Does this commit add new dependencies (e.g. Python modules)? If yes, please evaluate carefully if the additional dependency is a more sustainable option than including the functionality in own code. If the former, describe the dependency clearly, add them to the Software Management Plan and the installation instructions (*.md files, CMake files, Docker files etc.).
Reviewer's checklist
All reviewers can help ensure accuracy, clarity, completeness, and adherence to the Contribution Guidelines.
Reviewer
-
Review by a code reviewer or other selected colleague to confirm accuracy, clarity, and completeness. This can be skipped for minor fixes without substantive content changes.
Maintainer
-
Review by assigned maintainer, who can always request/require the above reviews.