Commit 1c35139c authored by Jay Dubb's avatar Jay Dubb
Browse files

v1.21.2

-- Step 2 of changing the way Homer3 stores the group data in memory, how it saves processed data and loads processed and acquired data. Finish getting rid of all remaining code related to the previous solution to the problem of loading and keeping a large data set in memory; a half-measure which calculated dc and dod automatically when Homer3 starts up by sensing that there's derived data that was previously calculated in groupResults.mat.

-- Clean up Calc() method a little bit in preparation for new solution to the above-described problem

-- Add foolproof functionality to ConfigFileClass to be able to restore original config file instead of rewriting AppSettings with same parameters simply make a backup copy whenever you save the config  file and use the new Restore method to get back to original version. That way whenever we run the unit test version control will not show that the file changed even though the substance is same as original.

-- Add code to unit test to be able to call clean up when user interrupts it.

-- Make version2string - converting version cell array return by getVernum to string - a simpler and more robust function.

-- Add DesignNotes.odp OpenOffice version and add 2 diagrams if how the dataTree works
parent 2c1aad11
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
@@ -427,21 +427,19 @@ classdef GroupClass < TreeNodeClass
                        tHRF_common{iBlk} = s(iSubj).procStream.output.GetTHRF(iBlk);
                    end
                end
                
            end
           
            
            % Instantiate all the variables that might be needed by
            % procStream.Calc() to calculate proc stream for this group
            vars = [];
            for iSubj = 1:nSubj
                % Set common tHRF: make sure size of tHRF, dcAvg and dcAvg is same for
                % all subjs. Use smallest tHRF as the common one.
            for iSubj = 1:nSubj
                for iBlk = 1:length(tHRF_common)
                    s(iSubj).procStream.output.SettHRFCommon(tHRF_common{iBlk}, s(iSubj).name, s(iSubj).type, iBlk);
                end
            end

            % Instantiate all the variables that might be needed by
            % procStream.Calc() to calculate proc stream for this group
            vars = [];
            for iSubj = 1:nSubj
                vars.dodAvgSubjs{iSubj}    = s(iSubj).procStream.output.GetVar('dodAvg');
                vars.dodAvgStdSubjs{iSubj} = s(iSubj).procStream.output.GetVar('dodAvgStd');
                vars.dcAvgSubjs{iSubj}     = s(iSubj).procStream.output.GetVar('dcAvg');
@@ -474,17 +472,6 @@ classdef GroupClass < TreeNodeClass
        
        
        
        % ----------------------------------------------------------------------------------
        function CalcRunLevelTimeCourse(obj)
            % Calculate all subjs in this session
            s = obj.subjs;
            nSubj = length(s);
            for iSubj = 1:nSubj
                s(iSubj).CalcRunLevelTimeCourse();
            end
        end
        

        % ----------------------------------------------------------------------------------
        function Print(obj, indent)
            if ~exist('indent', 'var')
+59 −40
Original line number Diff line number Diff line
@@ -121,10 +121,28 @@ classdef ProcResultClass < handle
            end
        end
        
    end
        
        
    methods
        
        % ----------------------------------------------------------------------------------
        function AddVars(obj, vars, filename)
        function SetFilename(obj, filename)
            if isempty(filename)
                return;
            end
            [pname, fname] = fileparts(filename);
            if isempty(pname)
                pname = '.';
            end
            obj.filename = [pname, '/', fname, '.mat'];
        end
        
        
        % ----------------------------------------------------------------------------------
        function Save(obj, vars, filename)            
            obj.SetFilename(filename)

            output = obj;
            props = propnames(vars);
            for ii=1:length(props)
@@ -175,7 +193,6 @@ classdef ProcResultClass < handle
        
        % ----------------------------------------------------------------------------------
        function t = GetTHRF(obj, iBlk)
            t = [];
            if ~exist('iBlk','var') || isempty(iBlk)
                iBlk = 1;
            end
@@ -235,7 +252,7 @@ classdef ProcResultClass < handle
        
        
        % ----------------------------------------------------------------------------------
        function yavg = GetDodAvg(obj, type, condition, iBlk)
        function yavg = GetDodAvg(obj, type, condition, iBlk) %#ok<*INUSL>
            yavg = [];
            
            % Check type argument
@@ -243,7 +260,7 @@ classdef ProcResultClass < handle
                type = 'dodAvg';
            end
            if ~exist('iBlk','var') || isempty(iBlk)
                iBlk = 1;
                iBlk = 1; %#ok<NASGU>
            end
            
            if ~ischar(type)
@@ -292,7 +309,7 @@ classdef ProcResultClass < handle
                type = 'dcAvg';
            end
            if ~exist('iBlk','var') || isempty(iBlk)
                iBlk = 1;
                iBlk = 1; %#ok<NASGU>
            end
            
            if ~ischar(type)
@@ -334,14 +351,14 @@ classdef ProcResultClass < handle
        % ----------------------------------------------------------------------------------
        function y = GetDataTimeCourse(obj, type, iBlk)
            y = [];
            options = '';
            options = ''; %#ok<NASGU>
            
            % Check type argument
            if ~exist('type','var') || isempty(type)
                type = 'dcAvg';
            end
            if ~exist('iBlk','var') || isempty(iBlk)
                iBlk = 1;
                iBlk = 1; %#ok<NASGU>
            end
            
            if ~ischar(type)
@@ -353,7 +370,7 @@ classdef ProcResultClass < handle
                    return;
                end
                if strcmp(type, 'dc') || strcmp(type, 'dcAvg') || strcmp(type, 'dodAvg')
                    options = 'reshape';
                    options = 'reshape'; %#ok<NASGU>
                end
                y = eval(sprintf('obj.%s(iBlk).GetDataTimeSeries(options)', type));
            else
@@ -439,7 +456,6 @@ classdef ProcResultClass < handle
        
        % ----------------------------------------------------------------------------------
        function mlActAuto = GetMeasListActAuto(obj, iBlk)
            mlActAuto = {};
            if ~exist('iBlk','var') || isempty(iBlk)
                iBlk=1;
            end
@@ -471,7 +487,7 @@ classdef ProcResultClass < handle
    methods
        
        % ----------------------------------------------------------------------------------
        function Copy(obj, obj2, filename)
        function Copy(obj, obj2)
            if ~isa(obj, 'ProcResultClass')
                return;
            end
@@ -501,45 +517,48 @@ classdef ProcResultClass < handle
        
        
        % ----------------------------------------------------------------------------------
        function b = HaveBlockAvgOutput(obj)
            b=0;
        function b = IsEmpty(obj)
            b = false;
            if isempty(obj)
                return;
                return
            end
            if ~isempty(obj.dcAvg)
                b=1;
            if ~isempty(obj.dod)
                return
            end
            if ~isempty(obj.dc)
                return
            end
            if ~isempty(obj.dodAvg)
                b=1;
                return
            end
            if ~isempty(obj.dcAvg)
                return
        	end
        
        
        % ----------------------------------------------------------------------------------
        function b = HaveTimeCourseOutput(obj)
            b=0;
            if isempty(obj)
                return;
            if ~isempty(obj.dodAvgStd)
                return
            end
            if ~isempty(obj.dc)
                b=1;
            if ~isempty(obj.dcAvgStd)
                return
            end
            if ~isempty(obj.dod)
                b=1;
            if ~isempty(obj.dodSum2)
                return
            end
            if ~isempty(obj.dcSum2)
                return
            end
        
        
        % ----------------------------------------------------------------------------------
        function b = IsEmpty(obj)
            b=0;
            if obj.HaveTimeCourseOutput()
                return;
            if ~isempty(obj.tHRF)
                return
            end
            if obj.HaveBlockAvgOutput()
                return;
            if ~isempty(obj.nTrials)
                return
        	end
            if ~isempty(obj.grpAvgPass)
                return
            end
            if ~isempty(obj.misc)
                return
            end
            b=1;
            b = false;
        end
        
        
+3 −53
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ classdef ProcStreamClass < handle
            obj.fcalls(ii+1:end) = [];
            
            obj.input.Copy(obj2.input);
            obj.output.Copy(obj2.output, filename);
            obj.output.Copy(obj2.output);
        end
        
        
@@ -239,11 +239,10 @@ classdef ProcStreamClass < handle
            for ii=1:length(paramOut)
                eval( sprintf('paramsOutStruct.%s = %s;', paramOut{ii}, paramOut{ii}) );
            end            
            obj.output.AddVars(paramsOutStruct, filename);
            obj.output.Save(paramsOutStruct, filename);
            
            obj.input.misc = [];
            close(hwait);
                        
        end
        
        
@@ -259,27 +258,6 @@ classdef ProcStreamClass < handle
        
        
        
        % ----------------------------------------------------------------------------------
        function FcallsIdxsTimeCourses(obj)
            if ~obj.output.HaveBlockAvgOutput()
                return;
            end
            idxs = zeros(1, length(obj.fcalls));
            for ii=1:length(obj.fcalls)
                sargout = ParseOutputArgs(obj, ii);
                if strfind('dod', sargout) %#ok<*STRIFCND>
                    idxs(ii) = 1;
                end
                if strfind('dc', sargout)
                    idxs(ii) = 1;
                end
            end
            k = find(idxs==1);
            obj.fcallsIdxs=1:k(end);
        end
                
        
        
        % ----------------------------------------------------------------------------------
        function FcallsIdxsReset(obj)
            obj.fcallsIdxs=[];
@@ -316,34 +294,6 @@ classdef ProcStreamClass < handle
            end
        end
        
        
        
        % ----------------------------------------------------------------------------------
        function b = HaveBlockAvgOutput(obj)
            b=0;
            if isempty(obj)
                return;
            end
            if isempty(obj.output)
                return;
            end
            b = obj.output.HaveBlockAvgOutput();
        end
        
        
        
        % ----------------------------------------------------------------------------------
        function b = HaveTimeCourseOutput(obj)
            b=0;
            if isempty(obj)
                return;
            end
            if isempty(obj.output)
                return;
            end
            b = obj.output.HaveTimeCourseOutput();
        end
                
    end
    
    
+0 −12
Original line number Diff line number Diff line
@@ -217,18 +217,6 @@ classdef RunClass < TreeNodeClass


        
        % ----------------------------------------------------------------------------------
        function CalcTimeCourses(obj)
            if obj.procStream.HaveTimeCourseOutput()
                return;
            end
            obj.procStream.FcallsIdxsTimeCourses();
            obj.Calc('keepexisting');
            obj.procStream.FcallsIdxsReset();
        end
        
        
        
        % ----------------------------------------------------------------------------------
        function Print(obj, indent)
            if ~exist('indent', 'var')
+6 −18
Original line number Diff line number Diff line
@@ -196,18 +196,17 @@ classdef SubjClass < TreeNodeClass
                end
            end
            
            
            % Instantiate all the variables that might be needed by
            % procStream.Calc() to calculate proc stream for this subject
            vars = [];
            for iRun = 1:nRun
                % Set common tHRF: make sure size of tHRF, dcAvg and dcAvg is same for
                % all runs. Use smallest tHRF as the common one.
            for iRun = 1:nRun
                for iBlk = 1:length(tHRF_common)
                    r(iRun).procStream.output.SettHRFCommon(tHRF_common{iBlk}, r(iRun).name, r(iRun).type, iBlk);
                end
            end            

            % Instantiate all the variables that might be needed by
            % procStream.Calc() to calculate proc stream for this subject
            vars = [];
            for iRun = 1:nRun
                vars.dodAvgRuns{iRun}    = r(iRun).procStream.output.GetVar('dodAvg');
                vars.dodAvgStdRuns{iRun} = r(iRun).procStream.output.GetVar('dodAvgStd');
                vars.dodSum2Runs{iRun}   = r(iRun).procStream.output.GetVar('dodSum2');
@@ -245,17 +244,6 @@ classdef SubjClass < TreeNodeClass
        end
                
        
        % ----------------------------------------------------------------------------------
        function CalcRunLevelTimeCourse(obj)
            r = obj.runs;
            nRun = length(r);
            for iRun = 1:nRun
                r(iRun).CalcTimeCourses();
            end
        end
        
        

        % ----------------------------------------------------------------------------------
        function Print(obj, indent)
            if ~exist('indent', 'var')
Loading