export_movies_synthetic.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import view
  2. import pathlib as pl
  3. # this tells view all settings including the folder structure of your project
  4. # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......"
  5. # insert your current directory
  6. #moaf = r"/Users/galizia/Documents/DATA/synthetic_data/"
  7. # or detect your directory, skipping the last folder
  8. moaf = pl.Path(__file__).parents[1]
  9. print('working in directory: ', moaf)
  10. # this tells view all settings including the folder structure of your project
  11. # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......"
  12. ymlfile = moaf / r"view_synthetic_666.yml"
  13. # any manual changes to flags, add to dictionary as required
  14. # i.e. flags that should have a different value from the project .yml file above
  15. flags_to_update = {
  16. "RM_ROITrace": 3, # set to 0 for .coor files, 3 for .roi files and 4 for .roi.tif
  17. # Other flag changes can be included, for example:
  18. # CTV_scalebar: True,
  19. # mv_individualScale: 2,
  20. # .....
  21. }
  22. # list of animals for which moview are to be exported
  23. animals = [
  24. "Synthetic_data_strip"#,
  25. #""
  26. ]
  27. Analyze_column_values_to_use = (-1,1)
  28. if __name__ == '__main__':
  29. # create a view object
  30. view_obj = view.VIEW()
  31. # load flags from yml file
  32. view_obj.update_flags_from_ymlfile(ymlfile)
  33. # update flags specified locally
  34. view_obj.update_flags(flags_to_update)
  35. # iterate over animals
  36. for animal in animals:
  37. # initialize view object with animal
  38. view_obj.initialize_animal(animal=animal)
  39. # iterate over measurements of the animal
  40. for measu in view_obj.get_measus_for_current_animal(analyze_values_to_use=Analyze_column_values_to_use):
  41. # load a measurement for the animal
  42. view_obj.load_measurement_data_from_current_animal(measu)
  43. # calculate signals
  44. view_obj.calculate_signals()
  45. # save movie for the loaded data
  46. view_obj.export_movie_for_current_measurement()
  47. # backup this script and the yml file used next to the created GDMs
  48. view_obj.backup_script_flags_configs_for_movies(files=[__file__, ymlfile])