selectedStrandID = gds.selectedStrandData.strandID;
selectedStrand = gds.Strands(selectedStrandID);
startAttachedStrands = [gds.Vertices.StrandIndices(selectedStrand.StartVertexIndex,:)];
startAttachedStrands = startAttachedStrands(startAttachedStrands~=0);
startAttachedStrands = startAttachedStrands(startAttachedStrands~=selectedStrandID);
endAttachedStrands = [gds.Vertices.StrandIndices(selectedStrand.EndVertexIndex,:)];
endAttachedStrands = endAttachedStrands(endAttachedStrands~=0);
endAttachedStrands = endAttachedStrands(endAttachedStrands~=selectedStrandID);
startMedianRadius = median(gds.Vertices.AllRadii(startAttachedStrands));
endMedianRadius = median(gds.Vertices.AllRadii(endAttachedStrands));
if startMedianRadius > endMedianRadius,
nextRoundStrands = endAttachedStrands;
trackedStrands = [selectedStrandID,endAttachedStrands];
else
nextRoundStrands = startAttachedStrands;
trackedStrands = [selectedStrandID,startAttachedStrands];
end
currentRatioCell = {};
branchIter = 1;
clotCurrent = gds.clotAnalysisParameters.strandCurrentList(selectedStrandID);
origCurrent = gds.circuitAnalysisParameters.strandCurrentList(selectedStrandID);
currentRatio = clotCurrent./origCurrent;
currentRatioCell{1} = currentRatio;
for branchIter = 2:10,
seedStrands = nextRoundStrands;
nextRoundStrands = [];
currentRatioList = [];
for strandIter = 1:numel(seedStrands),
thisStrandID = seedStrands(strandIter);
thisStrand = gds.Strands(thisStrandID);
clotCurrent = gds.clotAnalysisParameters.strandCurrentList(thisStrandID);
origCurrent = gds.circuitAnalysisParameters.strandCurrentList(thisStrandID);
currentRatio = clotCurrent./origCurrent;
currentRatioList = [currentRatioList,currentRatio];
allAttachedStrands = [gds.Vertices.StrandIndices(thisStrand.StartVertexIndex,:),gds.Vertices.StrandIndices(thisStrand.EndVertexIndex,:)];
nextStrands = allAttachedStrands(~ismember(allAttachedStrands,trackedStrands));
nextStrands = nextStrands(nextStrands~=0);
trackedStrands = [trackedStrands,nextStrands];
nextRoundStrands = [nextRoundStrands,nextStrands];
end
currentRatioCell{branchIter} = currentRatioList;
end
medianRatioList = [];
for kk = 1:numel(currentRatioCell);
q = currentRatioCell{kk};
q = q(~isnan(q));
medianRatioList(kk) = median(abs(q));
runningMedianRatioList{kk} = [runningMedianRatioList{kk},median(abs(q))];
end
figure(1);plot(medianRatioList,'r.');
figure(2);plot(0,0);hold on
for kk = 1:numel(currentRatioCell);
q = currentRatioCell{kk};
q = q(~isnan(q));
for jj = 1:numel(q);
plot(kk,abs(q(jj)),'b.');
end
end
figure(3);plot(0,0);hold on
for kk = 1:numel(runningMedianRatioList);
q = runningMedianRatioList{kk};
q = q(~isnan(q));
for jj = 1:numel(q);
plot(kk,abs(q(jj)),'bo');
end
end