Commit 477e9ca4 authored by sstucker's avatar sstucker
Browse files

Checkbox for display of std in PlotProbe

parent 762172ec
Loading
Loading
Loading
Loading
+1.61 KiB (64.1 KiB)

File changed.

No diff preview for this file type.

+12 −0
Original line number Diff line number Diff line
@@ -322,10 +322,12 @@ plotprobe.t = cell(nDataBlks,1);
for iBlk=1:nDataBlks
    if datatype == plotprobe.datatypeVals.OD_HRF
        plotprobe.y{iBlk} = currElem.GetDodAvg(condition, iBlk);
        plotprobe.ystd{iBlk} = plotprobe.dataTree.currElem.GetDodAvgStd(condition, iBlk);
        plotprobe.t{iBlk} = currElem.GetTHRF();
        plotprobe.tMarkUnits='(AU)';
    elseif datatype == plotprobe.datatypeVals.CONC_HRF
        plotprobe.y{iBlk} = currElem.GetDcAvg(condition, iBlk);
        plotprobe.ystd{iBlk} = plotprobe.dataTree.currElem.GetDcAvgStd(condition, iBlk);
        plotprobe.t{iBlk} = currElem.GetTHRF();
        plotprobe.tMarkAmp = plotprobe.tMarkAmp/1e6;
        plotprobe.tMarkUnits = '(micro-molars)';
@@ -777,3 +779,13 @@ else
    SyncBrowsing(plotprobe, 'off');
end



% --------------------------------------------------------------------
function radiobuttonShowStd_Callback(hObject, ~, handles)
global plotprobe
ClearAxesData();
nDataBlks = plotprobe.dataTreeHandle.currElem.GetDataBlocksNum();
for iBlk=1:nDataBlks
    plotProbeAndSetProperties(handles, iBlk);
end
+17 −40
Original line number Diff line number Diff line
@@ -232,7 +232,15 @@ try
            end
            
            
            % Plot data curves
            if ~isempty(ystd) % Plot error bars if available
                h(idx,1)=errorbar(xT, AvgT(:,1), ystd(:,1), 'color',color(1,:), 'visible',lv{idx,1});
                if size(AvgT,2)>1
                    h(idx,2)=errorbar(xT, AvgT(:,2), ystd(:,2), 'color',color(2,:), 'visible',lv{idx,2});
                end
                if size(AvgT,2)>2
                    h(idx,3)=errorbar(xT, AvgT(:,3), ystd(:,3), 'color',color(3,:), 'visible',lv{idx,3});
                end
            else % Plot data without error bars
                h(idx,1)=plot( xT, AvgT(:,1),'color',color(1,:), 'visible',lv{idx, 1});
                if size(AvgT,2)>1
                    h(idx,2)=plot( xT, AvgT(:,2),'color',color(2,:), 'visible',lv{idx, 2});
@@ -240,7 +248,7 @@ try
                if size(AvgT,2)>2
                    h(idx,3)=plot( xT, AvgT(:,3),'color',color(3,:), 'visible',lv{idx, 3});
                end 

            end
            
            % Plot time markers starting with stim onset
            if length(tAmp)==1
@@ -285,37 +293,6 @@ try
                end
            end
            
            % Plot standard deviation if provided
            if ~isempty(ystd)
                if ndims(Avg)==3
                    AvgT = ya-axHgt/4 + axHgt*((Avg(:,:,idx)-ystd(:,:,idx)-cmin)/(cmax-cmin))/2;
                else
                    AvgT(:,1) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))-ystd(:,lstW1(idx))-cmin)/(cmax-cmin))/2;
                    AvgT(:,2) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))-ystd(:,lstW2(idx))-cmin)/(cmax-cmin))/2;
                end
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':', 'visible',lv{idx,ii});
                if size(AvgT,2)>1
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                if size(AvgT,2)>2
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                
                if ndims(Avg)==3
                    AvgT = ya-axHgt/4 + axHgt*((Avg(:,:,idx)+ystd(:,:,idx)-cmin)/(cmax-cmin))/2;
                else
                    AvgT(:,1) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))+ystd(:,lstW1(idx))-cmin)/(cmax-cmin))/2;
                    AvgT(:,2) = ya-axHgt/4 + axHgt*((Avg(:,lstW1(idx))+ystd(:,lstW2(idx))-cmin)/(cmax-cmin))/2;
                end
                h(idx,1)=plot( xT, AvgT(:,1), 'linewidth',0.5,'color',color(1,:),'linestyle',':', 'visible',lv{idx,ii});
                if size(AvgT,2)>1
                    h(idx,2)=plot( xT, AvgT(:,2), 'linewidth',0.5,'color',color(2,:),'linestyle',':', 'visible',lv{idx,ii});
                end
                if size(AvgT,2)>2
                    h(idx,3)=plot( xT, AvgT(:,3), 'linewidth',0.5,'color',color(3,:),'linestyle',':', 'visible',lv{idx,ii});
                end
            end
            
        end

        % After plotting all the data, modify lines colors, styles, and width
+9 −1
Original line number Diff line number Diff line
@@ -8,6 +8,13 @@ if ~exist('iFig','var') || isempty(iFig)
    iFig=1;
end

% If checkbox is checked, display std
if handles.radiobuttonShowStd.Value
   ystd  = plotprobe.ystd{iBlk} ./ sqrt(plotprobe.dataTree.currElem.GetNtrials(iBlk)); 
else
   ystd  = [];
end

y        = plotprobe.y{iBlk};
t        = plotprobe.t{iBlk};
tMarkInt = plotprobe.tMarkInt;
@@ -17,6 +24,7 @@ tMarkVis = plotprobe.tMarkShow;
ch       = plotprobe.dataTree.currElem.GetMeasList(iBlk);
SD       = plotprobe.dataTree.currElem.GetSDG();


set(handles.textTimeMarkersAmpUnits, 'string',plotprobe.tMarkUnits);
hData = plotProbe( y, t, SD, ch, [], axScl, tMarkInt, tMarkAmp, tMarkVis );
hData = plotProbe( y, t, SD, ch, ystd, axScl, tMarkInt, tMarkAmp, tMarkVis );
plotprobe.handles.data{iFig} = hData;