-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevalGate.m
More file actions
36 lines (28 loc) · 974 Bytes
/
evalGate.m
File metadata and controls
36 lines (28 loc) · 974 Bytes
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
function negSigCorr = evalGate(aGate, trackMatrix, trackIndexMatrix, nSplits, runCode)
global fitIX;
global stepNumber;
gateScores = applyGateFast(aGate, trackMatrix);
[scoresByFly, meanIX] = stratifyByFly(gateScores(:), trackIndexMatrix);
classIX = uniqueTypes(meanIX);
[sigCorr, noiseCorr] = signalCorrelation(scoresByFly, classIX);
negSigCorr = -sigCorr;
fileName = ['/groups/wilson/FitHistory/FitHistory-',num2str(fitIX,'%d'),'-',runCode,'.mat'];
a = dir(fileName);
if length(a) > 0
% Robustly try to load the file
robustLoad(fileName,8);
else
allScoresByFly = [];
allGates = {};
allFvals = [];
allFitIX = [];
allStepNum = [];
end
allScoresByFly = cat(2,allScoresByFly,scoresByFly(:));
allGates{end+1} = aGate;
allFvals(end+1) = negSigCorr;
allFitIX(end+1) = fitIX;
allStepNum(end+1) = stepNumber;
% Robust save
nTries = 4;
robustSave(fileName, nTries, 'allScoresByFly','allGates','allFvals','allFitIX','allStepNum','meanIX');