Commit a58f6121 authored by jayd1860's avatar jayd1860
Browse files

v1.32.7

-- Add more robust error checking to exclude .snirf files that can't load DataClass.m
-- Add better error checking to DataClass and MeasListClass
parent 328f2a45
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ classdef AcqDataClass < matlab.mixin.Copyable
    properties (Access = private)
        logger
    end
    properties (Access = public)
    properties (Access = protected)
        errmsgs
    end
    
+29 −0
Original line number Diff line number Diff line
@@ -96,6 +96,11 @@ classdef DataFilesClass < handle
        % ----------------------------------------------------
        function findDataSet(obj, type)
            obj.files = mydir([obj.pathnm, '/*.', type]);
            
            % Remove any files that cannot pass the basic test of loading
            % its data
            obj.ErrorCheck(type);
            
            if isempty( obj.files )                
                % If there are no data files in current dir, don't give up yet - check
                % the subdirs for data files.
@@ -278,6 +283,30 @@ classdef DataFilesClass < handle
        
        
        
        % ----------------------------------------------------------
        function ErrorCheck(obj, type)
            errorIdxs = [];

            % Assume constructor name follows from name of data format type
            constructor = sprintf('%sClass', [upper(type(1)), type(2:end)]);
            
            % Make sure function by that name exists; otherwise no way to
            % use it to check loadability
            if isempty(which(constructor))
                return;
            end
            
            % Try to create object of data type and load data into it
            for ii = 1:length(obj.files)
                eval(sprintf('o = %s(obj.files(ii).name);', constructor));
                if o.GetError()<0
                    errorIdxs = [errorIdxs, ii];
                end
            end
            obj.files(errorIdxs) = [];
        end
        
        
        % ----------------------------------------------------------
        function err = GetError(obj)
            err = obj.err;
+33 −13
Original line number Diff line number Diff line
@@ -140,8 +140,12 @@ classdef DataClass < FileLoadSaveClass
                        obj.measurementList(ii) = MeasListClass;
                    end
                    if obj.measurementList(ii).LoadHdf5(fileobj, [location, '/measurementList', num2str(ii)]) < 0
                        if ~obj.measurementList(ii).IsEmpty()
                            err = -1;                        
                        else
                            obj.measurementList(ii).delete();
                            obj.measurementList(ii) = [];
                        end
                        if ii == 1
                            err = -1;
                        end
@@ -155,6 +159,8 @@ classdef DataClass < FileLoadSaveClass
            catch ME
                err = -1;
            end
            
            err = ErrorCheck(obj, err);
        end
        
        
@@ -184,13 +190,6 @@ classdef DataClass < FileLoadSaveClass
            end
        end
        
    end
    
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Set/Get properties methods
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    methods
        
        % -------------------------------------------------------
        function b = IsEmpty(obj)
@@ -207,6 +206,27 @@ classdef DataClass < FileLoadSaveClass
        end
        
        
        % ----------------------------------------------------------------------
        function err = ErrorCheck(obj, err)
            if obj.IsEmpty()
                err = -1;
            end
            if size(obj.dataTimeSeries,1) ~= length(obj.time)
                err = -1;
            end
            if size(obj.dataTimeSeries,2) ~= length(obj.measurementList)
                err = -1;
            end
        end
        
    end
    
        
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Set/Get properties methods
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    methods
        
        % ---------------------------------------------------------
        function val = GetT(obj)
            val = obj.time;
+13 −1
Original line number Diff line number Diff line
@@ -131,6 +131,16 @@ classdef MeasListClass < FileLoadSaveClass
                return
            end
            
            if obj.IsEmpty()
                err = -1;
            end
            if obj.sourceIndex<1
                err = -1;
            end
            if obj.detectorIndex<1
                err = -1;
            end

        end

        
@@ -231,11 +241,13 @@ classdef MeasListClass < FileLoadSaveClass
        % -------------------------------------------------------
        function b = IsEmpty(obj)
            b = false;
            if obj.sourceIndex==0 && obj.detectorIndex==0
            if isempty(obj.sourceIndex) && isempty(obj.detectorIndex)
                b = true;
                return
            end
        end

        
        % -------------------------------------------------------
        function B = eq(obj, obj2)
            B = false;       
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ function [vrnnum] = getVernum_AtlasViewerGUI()

vrnnum{1} = '2';   % Major version #
vrnnum{2} = '15';  % Major sub-version #
vrnnum{3} = '7';   % Minor version #
vrnnum{3} = '8';   % Minor version #
vrnnum{4} = '0';   % Minor sub-version # or patch #: 'p1', 'p2', etc


@@ -30,6 +30,6 @@ function [vrnnum] = getVernum_Homer3()

vrnnum{1} = '1';   % Major version #
vrnnum{2} = '32';  % Major sub-version #
vrnnum{3} = '6';   % Minor version #
vrnnum{3} = '7';   % Minor version #
vrnnum{4} = '0';   % Minor sub-version # or patch #: 'p1', 'p2', etc