pro2tapestryConfigYML.py 1.5 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 = \
  5. r"/home/aj/UKN_network_drives/ag_galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/IDL_Progs"
  6. # output files will be created in this folder
  7. output_folder_for_tapestry_configs = \
  8. r"/home/aj/UKN_network_drives/ag_galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/pyPROGS/tapestry_configs"
  9. # just the name of the file, without the path
  10. # each of these files are expected to be found in the folder pointed to by `input_folder_containing_pros`
  11. pro_file_names = [
  12. "grl_A_5803a.pro"
  13. ]
  14. # these flags will override flags initializations from .pro files if present, else will be added.
  15. flags_to_override = {
  16. "SO_individualScale": 3
  17. }
  18. if __name__ == '__main__':
  19. # iterate through each of
  20. for pro_file_name in pro_file_names:
  21. # parse the animal tag from the file name of the .pro file
  22. animal_tag = parse_animal_tag(pro_file_name)
  23. # construct the full path of the .pro file
  24. pro_file_path = pl.Path(input_folder_containing_pros) / pro_file_name
  25. # construct the path for the output yml file
  26. op_yml_path = pl.Path(output_folder_for_tapestry_configs) / f"{animal_tag}.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. )