create_tapestry.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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"/home/aj/UKN_network_drives/ag_galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/usage_till.yml"
  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. "/home/aj/UKN_network_drives/ag_galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/pyPROGS/tapestry_configs/A_5803a.yml"
  9. ]
  10. # define a function that takes a row of the measurement list and returns a string. This string will be placed
  11. # below the overview
  12. def text_below(row):
  13. # Example 1: the label below each overview will just be the odor
  14. # return row['Odour']
  15. # Example 2: the label below each overview will be the odor and concentration separated by an underscore ("_")
  16. return f"{row['Odour']}_{row['OConc']}"
  17. # define a function that takes a row of the measurement list and returns a string. This string will be placed
  18. # next to the overview on the top right.
  19. def text_right_top(row):
  20. pass
  21. # define a function that takes a row of the measurement list and creates the string to be placed below the overview
  22. def text_right_bottom(row):
  23. pass
  24. if __name__ == '__main__':
  25. for tapestry_config_file in tapestry_config_files:
  26. # When text_right_bottom_func and text_right_top_func are specified to be None, the upper and lower limits
  27. # of the data shown in an overview will be printed to its right top and right bottom side
  28. # To customize the strings printed there, please define the functions 'text_right_top' and
  29. # 'text_right_bottom above and pass them appropriately below, in the place on 'None'.
  30. html_out_file, view_obj = view.create_tapestry(init_yml_flags_file=ymlfile,
  31. tapestry_config_file=tapestry_config_file,
  32. text_below_func=text_below,
  33. text_right_top_func=None,
  34. text_right_bottom_func=None)
  35. # backup this script and the yml file used next to the created tapestries
  36. view_obj.backup_script_flags_configs_for_tapestries(files=[__file__, ymlfile, tapestry_config_file])