Commit 86542aed authored by Meryem Ayse Yucel's avatar Meryem Ayse Yucel
Browse files

Fix on group averaging

When a subject had nan values on a channel/sbj, the group result ended being nan, even though the rest of the sbjs are good. Homer2 was unconsciously dealing with this issue by pruning outliers from group, since we do not have that feature in homer3, the issue came up. Issue is fixed now by identifying those channels and removing from group averaging.
parent c4f0a268
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -72,21 +72,23 @@ for iBlk = 1:nDataBlks
                    continue;
                end
                
                lstPass = find(~isnan(squeeze(mean(yAvg(:,1,:,iC),1))) == 1);
                
                if iSubj==1 | iC>nStim
                    for iCh = 1:nCh
                    for iPass=1:length(lstPass)
                        for iHb=1:3
                            % Make sure 3rd arg to interp1 is column vector to guarauntee interp1 output is column vector
                            % which matches grp1 dimensions when adding the two.
                            grp1(:,iHb,iCh,iC) = interp1(tHRF, yAvg(:,iHb,iCh,iC), tHRF(:));
                            grp1(:,iHb,lstPass(iPass),iC) = interp1(tHRF, yAvg(:,iHb,lstPass(iPass),iC), tHRF(:));
                        end
                    end
                    nStim = iC;
                else
                    for iCh = 1:size(yAvg,3)
                    for iPass=1:length(lstPass)
                        for iHb=1:3
                            % Make sure 3rd arg to interp1 is column vector to guarauntee interp1 output is column vector
                            % which matches grp1 dimensions when adding the two.
                            grp1(:,iHb,iCh,iC) = grp1(:, iHb, iCh, iC) + interp1(tHRF, yAvg(:,iHb,iCh,iC), tHRF(:));
                            grp1(:,iHb,lstPass(iPass),iC) = grp1(:, iHb, lstPass(iPass), iC) + interp1(tHRF, yAvg(:,iHb,lstPass(iPass),iC), tHRF(:));
                        end
                    end
                end