This repository has been archived by the owner on May 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
magnets_all.m
274 lines (252 loc) · 21.1 KB
/
magnets_all.m
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
% basefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_04_16\Capture 1_XY1523876898_C0_3',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_04_16\Capture 2_XY1523877944_C0_2',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_01_03\Capture 6_XY1514997239_Z0_upper',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_01_03\Capture 6_XY1514997239_Z0_lower'};
% imagefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_04_16\Capture 1_XY1523876898_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_04_16\Capture 2_XY1523877944_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_01_03\Capture 6_XY1514997239_Z0_T000_C1.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_01_03\Capture 6_XY1514997239_Z0_T000_C1.tiff'};
% lastMagnetFrame = [34, 41, 48, 48];
%%
basefilenames(1:4) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 2_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 4_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 5_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 6_C0'};
imagefilenames(1:4) = cellfun(@(s) [s, '.tiff'], basefilenames(1:4), 'UniformOutput', false);
lastMagnetFrame(1:4) = [37, 45, 31, 43];
sampleTime(1:4) = datetime('2018_08_08 11:30','InputFormat','yyyy_MM_dd HH:mm');
basefilenames(5:7) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 3_C0',...
...% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 4_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 5_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 6_C0'};
imagefilenames(5:7) = cellfun(@(s) [s, '.tiff'], basefilenames(5:7), 'UniformOutput', false);
% lastMagnetFrame(5:8) = [40, 33, 34, 30];
lastMagnetFrame(5:7) = [40, 34, 30]; % remove Capture 4
sampleTime(5:7) = datetime('2018_08_08 14:05','InputFormat','yyyy_MM_dd HH:mm');
basefilenames(8:12) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 2_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 3_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 4_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 5_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 6_C0'};
imagefilenames(8:12) = cellfun(@(s) [s, '.tiff'], basefilenames(8:12), 'UniformOutput', false);
lastMagnetFrame(8:12) = [37, 43, 38, 35, 24];
sampleTime(8:12) = datetime('2018_08_09 11:25','InputFormat','yyyy_MM_dd HH:mm');
basefilenames(13:16) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 3_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 4_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 5_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 6_C0'};
imagefilenames(13:16) = cellfun(@(s) [s, '.tiff'], basefilenames(13:16), 'UniformOutput', false);
lastMagnetFrame(13:16) = [37, 44, 50, 29];
sampleTime(13:16) = datetime('2018_08_09 14:00','InputFormat','yyyy_MM_dd HH:mm');
basefilenames(17:23) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_1',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_2',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_3',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 3_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 4_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 5_C0_2',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 5_C0_3'};
imagefilenames(17:23) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 3_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 4_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 5_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 5_C0.tiff'};
lastMagnetFrame(17:23) = [48, 48, 48, 34, 31, 48, 48];
sampleTime(17:23) = datetime('2018_08_09 15:00','InputFormat','yyyy_MM_dd HH:mm');
basefilenames(24:31) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 1_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 2_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 2_C0_2',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0_1',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0_2',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample3 17_35\Capture 1_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample4 18_00\Capture 1_C0',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample5 18_32\Capture 1_C0'};
imagefilenames(24:31) = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 1_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 2_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 2_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample3 17_35\Capture 1_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample4 18_00\Capture 1_C0.tiff',...
'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample5 18_32\Capture 1_C0.tiff'};
lastMagnetFrame(24:31) = [33, 33, 33, 36, 36, 35, 59, 51];
sampleTime(24:26) = datetime('2018_08_13 16:42','InputFormat','yyyy_MM_dd HH:mm');
sampleTime(27:28) = datetime('2018_08_13 17:07','InputFormat','yyyy_MM_dd HH:mm');
sampleTime(29) = datetime('2018_08_13 17:35','InputFormat','yyyy_MM_dd HH:mm');
sampleTime(30) = datetime('2018_08_13 18:00','InputFormat','yyyy_MM_dd HH:mm');
sampleTime(31) = datetime('2018_08_13 18:32','InputFormat','yyyy_MM_dd HH:mm');
% %% first droplets in samples
% basefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 2_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 3_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 2_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 3_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_1',...
% ...% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_2',...
% ...% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0_3',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 1_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0_1',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0_2',...
% ...%'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample3 17_35\Capture 1_C0',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample4 18_00\Capture 1_C0'};%,...
% %'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample5 18_32\Capture 1_C0'};
%
% imagefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix1 sample1\Capture 2_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_08\mix2 sample1\Capture 3_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix1 sample1\Capture 2_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample1\Capture 3_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
% ...% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
% ...% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_09\mix2 sample2\Capture 2_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample1 16_42\Capture 1_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample2 17_05\Capture 1_C0.tiff',...
% ...%'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample3 17_35\Capture 1_C0.tiff',...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample4 18_00\Capture 1_C0.tiff'};%,...
% % 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_08_13\mix2 sample5 18_32\Capture 1_C0.tiff'};
% % lastMagnetFrame = [37, 40, 37, 37, 48, 48, 48, 33, 36, 36, 35, 59, 51];
% % lastMagnetFrame = [37, 40, 37, 37, 48, 48, 48, 33, 36, 36, 59, 51];
% lastMagnetFrame = [37, 40, 37, 37, 48, 33, 36, 36, 59];
% %% 60%
% basefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 1' ,...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 2' ,...
% ...%'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 5' ,...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 6', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 1_C0', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 2_C0', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 4_C0'};
% imagefilenames = {'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 1_T000_C0.tiff' ,...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 2_T000_C1.tiff' ,...
% ...%'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 5_T000_C0.tiff' ,...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample1\NCapture 6_T000_C0.tiff', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 1_C0.tiff', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 2_C0.tiff', ...
% 'W:\phkinnerets\storage\analysis\Niv\magnetic beads\magnetic beads in capillary\spinning disk\2018_05_14\60% control\mix2 sample2\Capture 4_C0.tiff'};
% lastMagnetFrame = [43,...
% 57,...
% ...%116,...
% 38,...
% 42,...
% 41,...
% 40];
%%
clear CCData;
clear drops;
clear captureTime;
for i = 1:length(basefilenames)
filename = basefilenames{i};
dataFilename = [filename,'.mat'];
% logFilename = strrep(imagefilenames{i},'.tiff','.log');
data = load(dataFilename);
drops{i} = data.droplets;
CCData(i) = smooth_data(drops{i}, -1, 1,[3,35], 1, 7, lastMagnetFrame(i) + 1);
captureTime(i) = readCaptureTime(imagefilenames{i});
end
for i=1:length(basefilenames)
if ~isfield(CCData(i), 'lastMagnetFrame') || isempty(CCData(i).lastMagnetFrame)
CCData(i).lastMagnetFrame = lastMagnetFrame(i);
end
end
timeDiff = captureTime - sampleTime;
%%
clear dropR SB maxV meanV pullingDistance
for i=1:length(CCData)
dropR(i) = mean(CCData(i).dropRadius);
SB(i) = (CCData(i).Rot.r(end) - CCData(i).Rot.r(1))/CCData(i).dropRadius(end);
maxV(i) = max(-CCData(i).Rot.VrSmooth(CCData(i).lastMagnetFrame:end));
meanV(i) = mean(-CCData(i).Rot.VrSmooth(CCData(i).lastMagnetFrame:end));
pullingDistance(i) = CCData(i).Rot.r(CCData(i).lastMagnetFrame);
end
%%
indSB = SB > 0.3;
indStuck = SB > 0.2 & SB < 0.3;
indCentering = SB < 0.2;
FigVelTimeCen = figure('Position',[100 100 250 300]);
FigVelTimeCen.PaperPositionMode = 'auto';
plot(timeDiff(indCentering), meanV(indCentering),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('time from sample preparation');
ylabel('mean recentering velocity [um/min]');
FigVelTimeAll = figure('Position',[100 100 250 300]);
FigVelTimeAll.PaperPositionMode = 'auto';
plot(timeDiff(indCentering), meanV(indCentering),'.','MarkerSize',10);
hold on;
plot(timeDiff(indStuck), meanV(indStuck),'.','MarkerSize',10);
plot(timeDiff(indSB), meanV(indSB),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('time from sample preparation');
ylabel('mean recentering velocity [um/min]');
legend({'centering', 'stuck', 'symmetry breaking'});
FigVelRadCen = figure('Position',[100 100 250 300]);
FigVelRadCen.PaperPositionMode = 'auto';
plot(dropR(indCentering), meanV(indCentering),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('drop radius [um]');
ylabel('mean recentering velocity [um/min]');
FigVelRadAll = figure('Position',[100 100 250 300]);
FigVelRadAll.PaperPositionMode = 'auto';
plot(dropR(indCentering), meanV(indCentering),'.','MarkerSize',10);
hold on;
plot(dropR(indStuck), meanV(indStuck),'.','MarkerSize',10);
plot(dropR(indSB), meanV(indSB),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('drop radius [um]');
ylabel('mean recentering velocity [um/min]');
legend({'centering', 'stuck', 'symmetry breaking'});
FigVelRadCen = figure('Position',[100 100 250 300]);
FigVelRadCen.PaperPositionMode = 'auto';
plot(dropR(indCentering), meanV(indCentering),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('drop radius [um]');
ylabel('mean recentering velocity [um/min]');
FigVelPullFracAll = figure('Position',[100 100 250 300]);
FigVelPullFracAll.PaperPositionMode = 'auto';
plot(pullingDistance(indCentering)./dropR(indCentering), meanV(indCentering),'.','MarkerSize',10);
hold on;
plot(pullingDistance(indStuck)./dropR(indStuck), meanV(indStuck),'.','MarkerSize',10);
plot(pullingDistance(indSB)./dropR(indSB), meanV(indSB),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('pulling fraction');
ylabel('mean recentering velocity [um/min]');
% legend({'centering', 'stuck', 'symmetry breaking'});
FigVelPullDistAll = figure('Position',[100 100 250 300]);
FigVelPullDistAll.PaperPositionMode = 'auto';
plot(pullingDistance(indCentering), meanV(indCentering),'.','MarkerSize',10);
hold on;
plot(pullingDistance(indStuck), meanV(indStuck),'.','MarkerSize',10);
plot(pullingDistance(indSB), meanV(indSB),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('pulling distance [um]');
ylabel('mean recentering velocity [um/min]');
% legend({'centering', 'stuck', 'symmetry breaking'});
FigNormVelRadCen = figure('Position',[100 100 250 300]);
FigNormVelRadCen.PaperPositionMode = 'auto';
plot(dropR(indCentering), meanV(indCentering)./(pullingDistance(indCentering)./dropR(indCentering)),'.','MarkerSize',10);
ax = gca;
ax.FontSize = 8;
xlabel('drop radius [um]');
ylabel('mean recentering velocity / pulling fraction [um/min]');
print(FigVelTimeCen, 'magnets_Centering_velocity_time_cen','-depsc');
print(FigVelRadCen, 'magnets_Centering_velocity_radius_cen','-depsc');
print(FigVelTimeAll, 'magnets_Centering_velocity_time_all','-depsc');
print(FigVelRadAll, 'magnets_Centering_velocity_radius_all','-depsc');
print(FigVelPullFracAll, 'magnets_Centering_velocity_pull_fraction_all','-depsc');
print(FigVelPullDistAll, 'magnets_Centering_velocity_pull_distance_all','-depsc');
FigSB = plot_velocity_paper_symbreaking(CCData(indSB),true, true, lastMagnetFrame(indSB), true);
FigStuck = plot_velocity_paper_symbreaking(CCData(indStuck),true, true, lastMagnetFrame(indStuck), true);
FigCentering = plot_velocity_paper(CCData(indCentering),true, true, lastMagnetFrame(indCentering), true);
print(FigSB(1),fullfile(['magnets_SB',FigSB(1).Name]),'-depsc');
print(FigStuck(1),fullfile(['magnets_stuck',FigStuck(1).Name]),'-depsc');
print(FigCentering(1),fullfile(['magnets_centering',FigCentering(1).Name]),'-depsc');
fprintf('%d out of %d broke symmetry \n', sum(indSB), numel(indSB))
fprintf('%d out of %d stuck \n', sum(indStuck), numel(indSB))
% for i=1:length(Fig)
% print(Fig(i),fullfile(outputDir,['magnets_',Fig(i).Name]),format);
% end