Mercurial > repos > bimib > cobraxy
changeset 146:88cf4543e210 draft
Uploaded
author | bimib |
---|---|
date | Wed, 06 Nov 2024 10:12:52 +0000 |
parents | 0f5564819296 |
children | 3fca9b568faf |
files | COBRAxy/marea.py |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/COBRAxy/marea.py Tue Nov 05 21:48:04 2024 +0000 +++ b/COBRAxy/marea.py Wed Nov 06 10:12:52 2024 +0000 @@ -20,7 +20,7 @@ ERRORS = [] ########################## argparse ########################################## ARGS :argparse.Namespace -def process_args() -> argparse.Namespace: +def process_args(args=None) -> argparse.Namespace: """ Interfaces the script of a module with its frontend, making the user's choices for various parameters available as values in code. @@ -147,11 +147,17 @@ help='custom map to use') parser.add_argument( + '-idop', '--output_path', + type = str, + default='result', + help = 'output path for maps') + + parser.add_argument( '-mc', '--choice_map', type = utils.Model, default = utils.Model.HMRcore, choices = [utils.Model.HMRcore, utils.Model.ENGRO2, utils.Model.Custom]) - args :argparse.Namespace = parser.parse_args() + args :argparse.Namespace = parser.parse_args(args) if args.using_RAS and not args.using_RPS: args.net = False return args @@ -651,7 +657,7 @@ # all output files: I don't care, this was never the performance bottleneck of the tool and # there is no other net gain in saving and re-using the built string. ext, - prefix = "result") + prefix = ARGS.output_path) FIELD_NOT_AVAILABLE = '/' def writeToCsv(rows: List[list], fieldNames :List[str], outPath :utils.FilePath) -> None: @@ -865,7 +871,7 @@ return { id : list(map(utils.Float("Dataset values, not an argument"), values)) for id, values in dataset.items() }, IDs ############################ MAIN ############################################# -def main() -> None: +def main(args=None) -> None: """ Initializes everything and sets the program in motion based on the fronted input arguments. @@ -876,10 +882,10 @@ sys.exit : if a user-provided custom map is in the wrong format (ET.XMLSyntaxError, ET.XMLSchemaParseError) """ global ARGS - ARGS = process_args() + ARGS = process_args(args) - if not os.path.isdir('result'): - os.makedirs('result') + if not os.path.isdir(ARGS.output_path): + os.makedirs(ARGS.output_path) core_map: ET.ElementTree = ARGS.choice_map.getMap( ARGS.tool_dir,