-
Notifications
You must be signed in to change notification settings - Fork 0
/
trackerErrorFinding.m
54 lines (49 loc) · 2.06 KB
/
trackerErrorFinding.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
mice = {'JK025','JK027','JK030','JK036','JK037','JK038','JK039','JK041','JK052','JK053','JK054','JK056'};
videoloc = 'D:\WhiskerVideo\';
if strcmp(videoloc(end),filesep)
whisker_d = videoloc;
else
whisker_d = ([videoloc filesep]);
end
sessions_pre = 1:3;
sessions = 1:31;
trackingErrors = cell(length(mice),34);
trackingErrorsProps = cell(length(mice),34);
for mi = 1 : length(mice)
for si = sessions
sessionName = sprintf('S%02d',sessions(si));
trackingErrors{mi,si} = [];
trackingErrorsProps{mi,si} = [];
try
cd([videoloc, mice{mi}, sessionName])
wsa = Whisker.WhiskerSignalTrialArray_2pad(pwd);
for wi = 1 : length(wsa.trials)
ws = wsa.trials{wi};
% noNaNInd = intersect(find(~isnan(sum(ws.whiskerEdgeCoord,2))), ws.poleUpFrames);
if length(intersect(ws.time{1}, ws.time{2})) < ws.nof * 0.9
trackingErrors{mi,si} = [trackingErrors{mi,si}, str2double(ws.trackerFileName)];
trackingErrorsProps{mi,si} = [trackingErrorsProps{mi,si}, length(intersect(ws.time{1}, ws.time{2})) / ws.nof];
end
end
catch
end
end
for si = sessions_pre
sessionName = sprintf('pre%d',sessions_pre(si));
trackingErrors{mi,si+31} = [];
trackingErrorsProps{mi,si} = [];
try
cd([videoloc, mice{mi}, sessionName])
wsa = Whisker.WhiskerSignalTrialArray_2pad(pwd);
for wi = 1 : length(wsa.trials)
ws = wsa.trials{wi};
% noNaNInd = intersect(find(~isnan(sum(ws.whiskerEdgeCoord,2))), ws.poleUpFrames);
if length(intersect(ws.time{1}, ws.time{2})) < ws.nof * 0.9
trackingErrors{mi,si+31} = [trackingErrors{mi,si+31}, str2double(ws.trackerFileName)];
trackingErrorsProps{mi,si} = [trackingErrorsProps{mi,si}, length(intersect(ws.time{1}, ws.time{2})) / ws.nof];
end
end
catch
end
end
end