Unverified Commit 831979f2 authored by jayd1860's avatar jayd1860 Committed by GitHub
Browse files

v1.37.0 (#132)

-- Fix errors in hmrR_tCCA and hmrR_GLM when aux channels with different sampling rates and different sampling rates with respect to the data as happened with NIRx data. Change SnirfClass method GetAuxDataMatrix to get all aux channels to be on same time base as the data.
-- Fix some bugs with freeing memory incorrectly when storage scheme is 'memory' (rather than the default 'files') in DataTreeClass and ProcResultClass.
-- Fix logger issue in Homer3.m with logging overwriting current session's earlier log entries when for instance running processing stream.
-- Fix incorrect display of currently selected channels MainGUI. Added function GetSelectedChannelIdxs to update selected channels.
-- Add functionality to unit test to make sure channel order in acquisition files does not generate incorrect processing results.
parent 14305eef
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -119,7 +119,11 @@ classdef FileClass < matlab.mixin.Copyable
                end
                end
                dirname(k) = '*';
                dirname(k) = '*';
            end
            end
            file = dir(dirname);
            temp = dir(dirname);
            if isempty(temp)
                return;
            end
            file = temp(1);
        end
        end
        
        
        
        
+28 −4
Original line number Original line Diff line number Diff line
@@ -999,17 +999,41 @@ classdef SnirfClass < AcqDataClass & FileLoadSaveClass
        end
        end
        
        
        
        
        
        % ---------------------------------------------------------
        % ---------------------------------------------------------
        function datamat = GetAuxDataMatrix(obj)
        function [datamat, p, Nmin] = GetAuxDataMatrix(obj, obj2)            
            datamat = [];
            datamat = [];
            p = 0;
            Nmin = 0;
            
            if isempty(obj.aux)
            if isempty(obj.aux)
                return;
                return;
            end
            end
            if ~exist('obj2','var')
                obj2 = obj.data(1);            
            end
            
            % Get all aux channels to be on the same time base with
            % obj2 which by default is the data
            p = round(1/mean(diff(obj2.GetTime())));
            d0 = obj2.GetDataTimeSeries();
            Nmin = size(d0,1);
            for ii = 1:length(obj.aux)
            for ii = 1:length(obj.aux)
                datamat(:,ii) = obj.aux(ii).GetDataTimeSeries();
                q = round(1/mean(diff(obj.aux(ii).GetTime())));
                d = obj.aux(ii).GetDataTimeSeries();
                temp{ii} = resample(d, p, q);
                if size(temp{ii},1) < Nmin
                    Nmin = size(temp{ii},1);
                end
                end
            end
            end


            % Create data matrix 
            for ii = 1:length(temp)
                datamat(:,ii) = temp{ii}(1:Nmin); %#ok<*AGROW>
            end
        end
        
        
        
        
        % ---------------------------------------------------------
        % ---------------------------------------------------------
        function names = GetAuxNames(obj)
        function names = GetAuxNames(obj)
@@ -1364,7 +1388,7 @@ classdef SnirfClass < AcqDataClass & FileLoadSaveClass
        
        
        
        
        % ----------------------------------------------------------------------------------
        % ----------------------------------------------------------------------------------
        function ToggleStims(obj, tPts, condition)
        function ToggleStims(obj, tPts, ~)
            % Find all stims for any conditions which match the time points.
            % Find all stims for any conditions which match the time points.
            for ii=1:length(obj.stim)
            for ii=1:length(obj.stim)
                obj.stim(ii).ToggleStims(tPts);
                obj.stim(ii).ToggleStims(tPts);
+3 −1
Original line number Original line Diff line number Diff line
@@ -512,7 +512,9 @@ classdef DataTreeClass < handle
            
            
            % Free up memory of current element before reassigning it to
            % Free up memory of current element before reassigning it to
            % another node. 
            % another node. 
            if strcmp(obj.dataStorageScheme, 'files')
                obj.currElem.FreeMemory();
                obj.currElem.FreeMemory();
            end
            
            
            if     iSubj==0 && iSess==0 && iRun==0
            if     iSubj==0 && iSess==0 && iRun==0
                obj.currElem = obj.groups(iGroup);
                obj.currElem = obj.groups(iGroup);
+2 −2
Original line number Original line Diff line number Diff line
@@ -118,7 +118,7 @@ classdef ProcResultClass < handle
                        if isa(obj.dcAvgStd, 'DataClass')
                        if isa(obj.dcAvgStd, 'DataClass')
                            obj.dcAvgStd(iBlk).TruncateTpts(abs(d));
                            obj.dcAvgStd(iBlk).TruncateTpts(abs(d));
                        else
                        else
                            obj.dcAvgStd(n+1:m,:,:) = [];
                            obj.dcAvgStd(n+1:m,:,:,:) = [];
                        end
                        end
                    end
                    end
                    if ~isempty(obj.dcSum2)
                    if ~isempty(obj.dcSum2)
@@ -200,7 +200,7 @@ classdef ProcResultClass < handle
            
            
            obj.SetFilename(filename);
            obj.SetFilename(filename);
            
            
            output = obj;
            output = obj; %#ok<NASGU>
            props = propnames(vars);
            props = propnames(vars);
            for ii=1:length(props)
            for ii=1:length(props)
                if eval( sprintf('isproperty(output, ''%s'');', props{ii}) )
                if eval( sprintf('isproperty(output, ''%s'');', props{ii}) )
+3 −0
Original line number Original line Diff line number Diff line
@@ -191,6 +191,9 @@ classdef ProcStreamClass < handle
            if ~exist('filename','var')
            if ~exist('filename','var')
                return
                return
            end
            end
            if ~ispathvalid(filename, 'file')
                return
            end
            obj.output.FreeMemory(filename)
            obj.output.FreeMemory(filename)
        end
        end


Loading