pro2tapestryConfigYML_template.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import pathlib as pl
  2. from view.idl_folder_translation.pro2tapestry_conf import parse_animal_tag, convert_pro_to_tapestry_config
  3. # input files are expected to be in this folder
  4. input_folder_containing_pros = r""
  5. # output files will be created in this folder
  6. output_folder_for_tapestry_configs = r""
  7. # just the name of the file, without the path
  8. # each of these files are expected to be found in the folder pointed to by `input_folder_containing_pros`
  9. pro_file_names = [
  10. "",
  11. ""
  12. ]
  13. # these flags will override flags initializations from .pro files if present, else will be added.
  14. flags_to_override = {
  15. "SO_individualScale": 3
  16. }
  17. if __name__ == '__main__':
  18. # iterate through each of
  19. for pro_file_name in pro_file_names:
  20. # parse the animal tag from the file name of the .pro file
  21. animal_tag = parse_animal_tag(pro_file_name)
  22. # construct the full path of the .pro file
  23. pro_file_path = pl.Path(input_folder_containing_pros) / pro_file_name
  24. # construct the path for the output yml file
  25. pro_file_name_stem = pro_file_name.split(".")[0]
  26. op_yml_path = pl.Path(output_folder_for_tapestry_configs) / f"{pro_file_name_stem}.yml"
  27. # convert
  28. convert_pro_to_tapestry_config(
  29. input_pro_file=pro_file_path, output_yml_file=op_yml_path, animal_tag=animal_tag,
  30. flags_to_override=flags_to_override
  31. )