-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsptPALM_main.py
More file actions
198 lines (170 loc) · 7.29 KB
/
sptPALM_main.py
File metadata and controls
198 lines (170 loc) · 7.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This work is licensed under the CC BY 4.0 License.
You are free to share and adapt this work, even for commercial purposes,
as long as you provide appropriate credit to the original creator.
Original Creator: Johannes Hohlbein (Wageningen University & Research)
Date of Creation: September, 2024
Full license details can be found at https://creativecommons.org/licenses/by/4.0/
"""
from analyse_movies_sptPALM import analyse_movies_sptPALM
from combine_analysed_data_sptPALM import combine_analysed_data_sptPALM
from plot_combined_data_sptPALM import plot_combined_data_sptPALM
from MC_diffusion_distribution_analysis_sptPALM import MC_diffusion_distribution_analysis_sptPALM
from set_parameters_sptPALM import set_parameters_sptPALM
from set_parameters_sptPALM_GUI import set_parameters_sptPALM_GUI
from combine_thunderstorm_csv_files import combine_thunderstorm_csv_files
def sptPALM_main():
"""
Main function to analyse single-particle-tracking Photo-Activated-Laser-Microscopy.
Run function sptPALM_main.py from within Spyder or any other Python framework.
CC BY 4.0 License.
Original Creator: Johannes Hohlbein (Wageningen University & Research)
Date of Creation: September, 2024
Parameters
----------
None.
Raises
------
Exception
None.
Returns
-------
input_parameter : DICT
DESCRIPTION.
data : DICT
DESCRIPTION.
comb_data : DICT
DESCRIPTION.
sim_input : DICT
DESCRIPTION.
"""
input_parameter = {}
data = {}
comb_data = {}
sim_input = {}
while True:
print('-')
PROMPT = """Choose and press Enter
0: Exit
1: Set parameters GUI
2: Analyse individual movies
3: Combine individually analysed movies
4: Plot combined data
5: Monte-Carlo DDA
6: Auxillary functions
\n"""
try: # Check prompt
prompt_input = int(input(PROMPT))
except ValueError:
print("Invalid input, please enter a number.")
continue
match prompt_input:
case 0:
print('Exit!')
break
case 1:
input_parameter = set_parameters_sptPALM()
input_parameter = set_parameters_sptPALM_GUI(input_parameter)
print(' Show input_parameter:') # Display analysis parameters
for key, value in input_parameter.items():
print(f" .{key}: {value}")
case 2: # analyse_movies_sptPALM,py
[data, input_parameter] = analyse_movies_sptPALM(input_parameter)
print("'data' now available in memory\n")
case 3: # combine_analysed_data_sptPALM.py
comb_data, input_parameter = combine_analysed_data_sptPALM(data, input_parameter)
print("Combined data 'comb_data' now available in memory\n")
case 4: # plot_combined_data_sptPALM.py
comb_data = plot_combined_data_sptPALM(comb_data, input_parameter)
case 5: # MCDDA
comb_data, input_parameter = MC_diffusion_distribution_analysis_sptPALM(comb_data, input_parameter, sim_input)
case 6: # Combine_ThunderSTORM_csv_files
while True:
print('--')
SUB_PROMPT = """ Choose and press Enter
0: Go back to main prompt
1: Combine ThunderSTORM *.csv files
2: Empty\n"""
try: # Check prompt
sub_prompt_input = int(input(SUB_PROMPT))
except ValueError:
print("Invalid input, please enter a number.")
continue
match sub_prompt_input:
case 0:
print('Exit sub!')
break
case 1: # combine_thunderstorm_csv_files
print('Run Combine_ThunderSTORM_csv_files')
combine_thunderstorm_csv_files()
case 2:
print('Do nothing....')
case _:
print("Invalid option, please choose a valid number.")
continue
case _:
print("Invalid option, please choose a valid number.")
continue
print("Done")
return input_parameter, data, comb_data, sim_input
if __name__ == "__main__":
sptPALM_main()
# Currently taken out:
# from set_parameters_sptPALM import set_parameters_sptPALM
# def merge_data_folders_files():
# print('-2-1-')
# # merge_data_folders_files implementation here
# return []
# def sptPALM_anaDDA(condition, comb_data=None):
# print('-6-')
# # Your implementation here
# return comb_data
# case 1: # Careful, this was a dirty hack in Matlab and might not work here!
# print('Edit parameters for data analysis!')
# print(' Look for the input_parameter in the Variable Explorer and edit it.')
# print(" When done, type '!continue' into the command line.")
# input_parameter = set_parameters_sptPALM()
# # Doesn't yet enable accessing the Variable Explorer :(
# pdb.set_trace() # This will pause execution and open the debugger
# case 2: # Combine_ThunderSTORM_csv_files
# while True:
# print('--')
# SUB_PROMPT = """ Choose and press Enter
# 0: Go back to main prompt
# 1: Merge data files from different sub-folders
# 2: NOT WORKING YET Run ImageJ/Fiji macro 'Cell Segmentation'
# 3: NOT WORKING YET Run ImageJ/Fiji macro 'ThunderStorm'
# 4: Combine ThunderSTORM *.csv files\n: """
# # Check prompt
# try:
# sub_prompt_input = int(input(SUB_PROMPT))
# except ValueError:
# print("Invalid input, please enter a number.")
# continue
# match sub_prompt_input:
# case int(0):
# print('Exit sub!')
# break
# case 1:
# print('Merge data files from different sub-folders')
# merge_data_folders_files()
# case 2:
# print('NOT IMPLEMENTED: Running ImageJ/Fiji macro'
# 'Cell Segmentation')
# # Running Cellseg implementation here
# case 3:
# print('NOT IMPLEMENTED: Running ThunderSTORM macro')
# # Running Thunderstorm implementation here
# case 4:
# print('Run Combine_ThunderSTORM_csv_files')
# combine_thunderstorm_csv_files()
# case _:
# print("Invalid option, please choose a valid number.")
# continue
# case 5: # Run everything until anaDDA
# data, para = sptPALM_analyse_movies()
# comb_data = sptPALM_combine_data(data)
# comb_data = sptPALM_plot_combined_data(comb_data)
# comb_data = sptPALM_anaDDA(1, comb_data)