create_tapestry_template.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import view
  2. # this tells view all settings including the folder structure of your project
  3. # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......"
  4. ymlfile = r""
  5. # please enter the paths of tapestry configuration files in ABSOLUTE form.
  6. # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......"
  7. tapestry_config_files = [
  8. "",
  9. ""
  10. ]
  11. # define a function that takes a row of the measurement list and returns a string. This string will be placed
  12. # below the overview
  13. def text_below(row):
  14. # Example 1: the label below each overview will just be the odor
  15. return row['Odour']
  16. # Example 2: the label below each overview will be the odor and concentration separated by an underscore ("_")
  17. # return f"{row['Odour']}_{row['OConc']}"
  18. # define a function that takes a row of the measurement list and returns a string. This string will be placed
  19. # next to the overview on the top right.
  20. def text_right_top(row):
  21. pass
  22. # define a function that takes a row of the measurement list and creates the string to be placed below the overview
  23. def text_right_bottom(row):
  24. pass
  25. if __name__ == '__main__':
  26. for tapestry_config_file in tapestry_config_files:
  27. # When text_right_bottom_func and text_right_top_func are specified to be None, the upper and lower limits
  28. # of the data shown in an overview will be printed to its right top and right bottom side
  29. # To customize the strings printed there, please define the functions 'text_right_top' and
  30. # 'text_right_bottom above and pass them appropriately below, in the place on 'None'.
  31. html_out_file, view_obj = view.create_tapestry(init_yml_flags_file=ymlfile,
  32. tapestry_config_file=tapestry_config_file,
  33. text_below_func=text_below,
  34. text_right_top_func=None,
  35. text_right_bottom_func=None)
  36. # backup this script and the yml file used next to the created tapestries
  37. view_obj.backup_script_flags_configs_for_tapestries(files=[__file__, ymlfile, tapestry_config_file])