DiamondLightSource / httomo

High-throughput tomography pipeline
https://diamondlightsource.github.io/httomo/
Other
5 stars 4 forks source link

Don't rely on `output_folder` global variable in YAML generator #259

Open yousefmoazzam opened 6 months ago

yousefmoazzam commented 6 months ago

The _save_yaml() function doesn't have a output_folder parameter, yet it somehow is able to refer to it without defining it itself: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L124-L131

This is because it's using the output_folder defined in the if __name__ == "__main__" block at the bottom of the script: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L228-L232

Given that the _save_yaml() function is called by the main yaml_generator() function: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L96

which has been passed the output_folder value: https://github.com/DiamondLightSource/httomo/blob/878c74c32dad626b46a52f1b4a8505747f5fd978/templates/yaml_templates_generator.py#L37-L42

it would be nice to pass _save_yaml() the output_folder value, rather than have it rely on a global variable.