Master_SpontActivity.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed May 30 10:13:47 2018
  4. @author: Giovanni Galizia
  5. copy of master
  6. in C:\\Users\\Giovanni Galizia\\Documents\\Code\\ShareWinXP\\WindowsExchange\\IDL_Data\\spont_activity\\00_copy_IDL
  7. """
  8. #from view.idl_translation_core
  9. import View_gr_reports as View_gr_reports, IDL_flags as IDL_flags
  10. from sys import platform
  11. #show images inline:
  12. #%matplotlib inline
  13. #show images in extra window
  14. #%matplotlib qt
  15. def Set_my_flags(flag):
  16. # use this to change any flags that are important locally
  17. #flag.STG_reporttag = '030725bR'
  18. flag.CSM_Movement = 0 # 2 for movement correction on the spot - is slow!
  19. flag.VIEW_batchmode = 1 # fo
  20. flag.LE_CalcMethod = 3950
  21. flag.VIEW_ReportMethod = 10
  22. flag.SO_Method = 10
  23. flag.SO_individualScale= 3
  24. flag.SO_MV_scalemax = 18.0
  25. flag.SO_MV_scalemin = -2.0
  26. flag.SO_withinArea= 0
  27. flag.CTV_firstframe = 18
  28. flag.CTV_lastframe = 22
  29. flag.CTV_Method = 35 #22
  30. flag.RM_fotook = 1
  31. flag.CTV_scalebar = 1
  32. return flag
  33. def ChooseFileFolder():
  34. import tkinter as tk
  35. from tkinter.filedialog import askopenfilenames
  36. # Choose raw files
  37. root = tk.Tk()
  38. root.withdraw() # so that windows closes after file chosen
  39. root.attributes('-topmost', True)
  40. # the mac system does not accept filetypes, therefore ask for system
  41. if platform == 'darwin':
  42. filenames = askopenfilenames(
  43. parent=root,
  44. title='Select one or more settings files (*.settings.xls)',
  45. ) # ask user to choose file
  46. else:
  47. filenames = askopenfilenames(
  48. parent=root,
  49. title='Select one or more settings files',
  50. filetypes=[('settings files', '*.settings.xls'), ('all files', '*')]
  51. ) # ask user to choose file
  52. return filenames
  53. #########################################################
  54. ########## Main starts here
  55. #########################################################
  56. # define flags
  57. #IDL.flags.IDL_default_flags sets the general rules
  58. #Set_my_flags modifies these
  59. #on my windows system
  60. STG_MotherOfAllFolders = 'C:\\Users\\Giovanni Galizia\\Documents\\Code\\ShareWinXP\\WindowsExchange\\IDL_Data\\spont_activity' #if empty, working directory is used
  61. if platform == 'darwin':
  62. STG_MotherOfAllFolders = '/Users/galizia/Documents/Code/ShareWinXP/WindowsExchange/IDL_Data/spont_activity'
  63. flag = Set_my_flags(IDL_flags.IDL_default_flags(STG_MotherOfAllFolders))
  64. #flag.STG_OdorReportPath = os.path.join(STG_MotherOfAllFolders + 'IDL_output\\movies\\'
  65. # call program that opens .lst file and performs analysis
  66. # the command in spont_activity_master.pro was "subloop, '24'
  67. (p1,flag) = View_gr_reports.gr_takefromlist('030725bR', 3, flag)
  68. # debug within takefromlist
  69. inputLabel = '030725bR'#, 2, flag
  70. SelectValue = 3