Mercurial > hg > ltpda
view testing/utp_1.1/utps/ao/utp_ao_split_chunks.m @ 45:a59cdb8aaf31 database-connection-manager
Merge
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 19:07:22 +0100 |
parents | 409a22968d5e |
children |
line wrap: on
line source
% UTP_AO_SPLIT a set of UTPs for the ao/split method % % M Hewitson 06-08-08 % % $Id: utp_ao_split_chunks.m,v 1.7 2011/09/29 12:09:56 ingo Exp $ % % <MethodDescription> % % The split method of the ao class splits an analysis object into the % specified segments. This UTP splits the AOs into sample segments. % % </MethodDescription> function results = utp_ao_split_chunks(varargin) % Check the inputs if nargin == 0 % Some keywords class = 'ao'; mthd = 'split'; results = []; disp('******************************************************'); disp(['**** Running UTPs for ' class '/' mthd]); disp('******************************************************'); % Test AOs [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao; at4.setY(randn(15)); % Exception list for the UTPs: [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples(); % Run the tests results = [results utp_01]; % getInfo call results = [results utp_02]; % Vector input results = [results utp_03]; % Matrix input results = [results utp_04]; % List input results = [results utp_05]; % Test with mixed input results = [results utp_06]; % Test history is working results = [results utp_07]; % Test the modify call works results = [results utp_08]; % Test input data shape == output data shape results = [results utp_09]; % Test output of the data results = [results utp_10]; % Test plist(N) || plist(CHUNKS) results = [results utp_11(mthd, at1, ple1, plist('N', 10))]; % Test plotinfo doesn't disappear results = [results utp_12]; % Test 'dx' and 'dy' results = [results utp_13]; % Test plist(match) results = [results utp_15]; % Test not equal sampled data (tsdata) disp('Done.'); disp('******************************************************'); elseif nargin == 1 % Check for UTP functions if strcmp(varargin{1}, 'isutp') results = 1; else results = 0; end else error('### Incorrect inputs') end %% UTP_01 % <TestDescription> % % Tests that the getInfo call works for this method. % % </TestDescription> function result = utp_01 % <SyntaxDescription> % % Test that the getInfo call works for no sets, all sets, and each set % individually. % % </SyntaxDescription> try % <SyntaxCode> % Call for no sets io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']); % Call for all sets io(2) = eval([class '.getInfo(''' mthd ''')']); % Call for each set for kk=1:numel(io(2).sets) io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']); end % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that getInfo call returned an minfo object in all cases. % 2) Check that all plists have the correct parameters. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % check we have minfo objects if isa(io, 'minfo') %%% SET 'None' idx = 1; if ~isempty(io(idx).sets), atest = false; end if ~isempty(io(idx).plists), atest = false; end %%% Check all Sets idx = 2; if ~any(strcmpi(io(idx).sets, 'Default')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By times')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By frequencies')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By samples')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By chunks')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By interval start/end')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By interval start/duration')), atest = false; end if ~any(strcmpi(io(idx).sets, 'By interval timespan')), atest = false; end if numel(io(idx).plists) ~= numel(io(idx).sets), atest = false; end %%%%%%%%%% SET 'Default' idx = 3; if io(idx).plists.nparams ~= 1, atest = false; end % Check key if ~io(idx).plists.isparam('times'), atest = false; end % Check default value if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end % Check options if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end %%%%%%%%%% SET 'By times' idx = 4; if io(idx).plists.nparams ~= 1, atest = false; end % Check key if ~io(idx).plists.isparam('times'), atest = false; end % Check default value if ~isEmptyDouble(io(idx).plists.find('times')), atest = false; end % Check options if ~isequal(io(idx).plists.getOptionsForParam('times'), {[]}), atest = false; end %%%%%%%%%% SET 'By frequencies' idx = 5; if io(idx).plists.nparams ~= 1, atest = false; end % Check key if ~io(idx).plists.isparam('frequencies'), atest = false; end % Check default value if ~isEmptyDouble(io(idx).plists.find('frequencies')), atest = false; end % Check options if ~isequal(io(idx).plists.getOptionsForParam('frequencies'), {[]}), atest = false; end %%%%%%%%%% SET 'By samples' idx = 6; if io(idx).plists.nparams ~= 1, atest = false; end % Check key if ~io(idx).plists.isparam('samples'), atest = false; end % Check default value if ~isEmptyDouble(io(idx).plists.find('samples')), atest = false; end % Check options if ~isequal(io(idx).plists.getOptionsForParam('samples'), {[]}), atest = false; end %%%%%%%%%% SET 'By chunks' idx = 7; if io(idx).plists.nparams ~= 2, atest = false; end % Check key if ~io(idx).plists.isparam('N'), atest = false; end if ~io(idx).plists.isparam('match'), atest = false; end % Check default value if ~isEmptyDouble(io(idx).plists.find('N')), atest = false; end if ~isequal(io(idx).plists.find('match'), true), atest = false; end % Check options if ~isequal(io(idx).plists.getOptionsForParam('N'), {[]}), atest = false; end if ~isequal(io(idx).plists.getOptionsForParam('match'), {true, false}), atest = false; end %%%%%%%%%% SET 'By interval start/end' idx = 8; if io(idx).plists.nparams ~= 2, atest = false; end % Check key if ~io(idx).plists.isparam('start_time'), atest = false; end if ~io(idx).plists.isparam('end_time'), atest = false; end % Check default value if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end if ~eq(io(idx).plists.find('end_time'), time(0), ple1), atest = false; end % Check options %%%%%%%%%% SET 'By interval start/duration' idx = 9; if io(idx).plists.nparams ~= 2, atest = false; end % Check key if ~io(idx).plists.isparam('start_time'), atest = false; end if ~io(idx).plists.isparam('duration'), atest = false; end % Check default value if ~eq(io(idx).plists.find('start_time'), time(0), ple1), atest = false; end if ~eq(io(idx).plists.find('duration'), time(0), ple1), atest = false; end % Check options %%%%%%%%%% SET 'By interval timespan' idx = 10; if io(idx).plists.nparams ~= 1, atest = false; end % Check key if ~io(idx).plists.isparam('timespan'), atest = false; end % Check default value ts = timespan(0,0); if ~eq(io(idx).plists.find('timespan'), ts, ple1), atest = false; end % Check options end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_01 %% UTP_02 % <TestDescription> % % Tests that the split method works with a vector of AOs as input. % % </TestDescription> function result = utp_02 % <SyntaxDescription> % % Test that the split method works for a vector of AOs as input. % % </SyntaxDescription> try % <SyntaxCode> N = 13; pl = plist('chunks', N); out = split(atvec, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that each output AO contains the correct data. % % </AlgoDescription> atest = true; TOL = 1e-12; if stest % <AlgoCode> % Check we have the correct number of outputs if numel(out) ~= numel(atvec) * N, atest = false; end % Check each output for kk=1:numel(atvec) ff = floor(length(atvec(kk).y)/N); is = 1:ff:length(atvec(kk).y); ie = ff:ff:length(atvec(kk).y); idx = sort([is(1:N) ie(1:N)]); idx(end) = length(atvec(kk).y); for jj = 1:N % Get reference values x = atvec(kk).x; y = atvec(kk).y; % Get and normalize for tsdata the values if isa(atvec(kk).data, 'tsdata') t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atvec(kk).t0.utc_epoch_milli)/1e3; ox = out((kk-1)*N+jj).x + t0off; else ox = out((kk-1)*N+jj).x; end oy = out((kk-1)*N+jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end end end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_02 %% UTP_03 % <TestDescription> % % Tests that the split method works with a matrix of AOs as input. % % </TestDescription> function result = utp_03 % <SyntaxDescription> % % Tests that the split method works with a matrix of AOs as input. % % </SyntaxDescription> try % <SyntaxCode> N = 4; pl = plist('chunks', N); out = split(atmat, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that each output AO contains the correct data. % % </AlgoDescription> atest = true; TOL = 1e-14; if stest % <AlgoCode> % Check we have the correct number of outputs if numel(out) ~= numel(atmat) * N, atest = false; end % Check each output for kk=1:numel(atmat) ff = floor(length(atmat(kk).y)/N); is = 1:ff:length(atmat(kk).y); ie = ff:ff:length(atmat(kk).y); idx = sort([is(1:N) ie(1:N)]); idx(end) = length(atmat(kk).y); for jj = 1:N % Get reference values x = atmat(kk).x; y = atmat(kk).y; % Get and normalize for tsdata the values if isa(atmat(kk).data, 'tsdata') t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atmat(kk).t0.utc_epoch_milli)/1e3; ox = out((kk-1)*N+jj).x + t0off; else ox = out((kk-1)*N+jj).x; end oy = out((kk-1)*N+jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if ~isa(atmat(kk).data, 'cdata') if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end else if ~isequal(oy, y(range).'), atest = false; end end end end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_03 %% UTP_04 % <TestDescription> % % Tests that the split method works with a list of AOs as input. % % </TestDescription> function result = utp_04 % <SyntaxDescription> % % Tests that the split method works with a matrix of AOs as input. % % </SyntaxDescription> try % <SyntaxCode> N = 4; pl = plist('chunks', N); out = split(at1, at2, at3, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that each output AO contains the correct data. % % </AlgoDescription> atest = true; TOL = 1e-14; aoin = [at1, at2, at3]; if stest % <AlgoCode> % Check we have the correct number of outputs if numel(out) ~= numel(aoin) * N, atest = false; end % Check each output for kk=1:numel(aoin) ff = floor(length(aoin(kk).y)/N); is = 1:ff:length(aoin(kk).y); ie = ff:ff:length(aoin(kk).y); idx = sort([is(1:N) ie(1:N)]); idx(end) = length(aoin(kk).y); for jj = 1:N % Get reference values x = aoin(kk).x; y = aoin(kk).y; % Get and normalize for tsdata the values if isa(aoin(kk).data, 'tsdata') t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; ox = out((kk-1)*N+jj).x + t0off; else ox = out((kk-1)*N+jj).x; end oy = out((kk-1)*N+jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if ~isa(aoin(kk).data, 'cdata') if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end else if ~isequal(oy, y(range).'), atest = false; end end end end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_04 %% UTP_05 % <TestDescription> % % Tests that the split method works with a mix of different shaped AOs as % input. % % </TestDescription> function result = utp_05 % <SyntaxDescription> % % Tests that the split method works with a matrix of AOs as input. % % </SyntaxDescription> try % <SyntaxCode> N = 3; pl = plist('chunks', N); out = split(at1, atmat, atvec, at3, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that each output AO contains the correct data. % % </AlgoDescription> atest = true; TOL = 1e-14; aoin = [at1, reshape(atmat, 1, []), reshape(atvec, 1, []), at3]; if stest % <AlgoCode> % Check we have the correct number of outputs if numel(out) ~= numel(aoin) * N, atest = false; end % Check each output for kk=1:numel(aoin) ff = floor(length(aoin(kk).y)/N); is = 1:ff:length(aoin(kk).y); ie = ff:ff:length(aoin(kk).y); idx = sort([is(1:N) ie(1:N)]); idx(end) = length(aoin(kk).y); for jj = 1:N % Get reference values x = aoin(kk).x; y = aoin(kk).y; % Get and normalize for tsdata the values if isa(aoin(kk).data, 'tsdata') t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - aoin(kk).t0.utc_epoch_milli)/1e3; ox = out((kk-1)*N+jj).x + t0off; else ox = out((kk-1)*N+jj).x; end oy = out((kk-1)*N+jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if ~isa(aoin(kk).data, 'cdata') if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end else if ~isequal(oy, y(range).'), atest = false; end end end end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_05 %% UTP_06 % <TestDescription> % % Tests that the split method properly applies history. % % </TestDescription> function result = utp_06 % <SyntaxDescription> % % Test that the result of applying the split method can be processed back. % % </SyntaxDescription> try % <SyntaxCode> pl = plist('N', 3); out = split(at1, pl); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the last entry in the history of 'out' corresponds to % 'split'. % 2) Check that the re-built object is the same object as the input. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check the last step in the history of 'out' if ~strcmp(out(1).hist.methodInfo.mname, 'split'), atest = false; end if ~strcmp(out(2).hist.methodInfo.mname, 'split'), atest = false; end if ~strcmp(out(3).hist.methodInfo.mname, 'split'), atest = false; end % The rebuilt object must be the same as 'out' if ~eq(mout, out, ple2), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_06 %% UTP_07 % <TestDescription> % % The split method can not modify the input AO. % % </TestDescription> function result = utp_07 % <SyntaxDescription> % % The split method can not modify the input AO. % % </SyntaxDescription> try % <SyntaxCode> pl = plist('N', 7); amodi = ao(at1); aeq = ao(at1); out = aeq.split(pl); amodi.split(pl); stest = false; % </SyntaxCode> catch stest = true; end % <AlgoDescription> % % 1) Nothind to do. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_07 %% UTP_08 % <TestDescription> % % Test the shape of the output. % % </TestDescription> function result = utp_08 % <SyntaxDescription> % % Test that the split method keeps the data shape of the input object. % The input AO must be an AO with row data and an AO with column data. % % </SyntaxDescription> try % <SyntaxCode> pl = plist('chunks', 3); out1 = split(at5, pl); out2 = split(at6, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the shape of the data doesn't change. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check the shape of the output data if size(out1(1).data.y,1) == 1, atest = false; end if size(out1(2).data.y,1) == 1, atest = false; end if size(out1(3).data.y,1) == 1, atest = false; end if size(out2(1).data.y,2) == 1, atest = false; end if size(out2(2).data.y,2) == 1, atest = false; end if size(out2(3).data.y,2) == 1, atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_08 %% UTP_09 % <TestDescription> % % Check that the split method pass back the output objects to a list of % output variables or to a single variable. % % </TestDescription> function result = utp_09 % <SyntaxDescription> % % Call the method with a list of output variables and with a single % output variable. Additionaly check that the rebuild method works on % the output. % % </SyntaxDescription> try % <SyntaxCode> pl = plist('chunks', 2); [o1, o2] = split(at5, pl); o3 = split(at5, pl); mout1 = rebuild(o1); mout2 = rebuild(o2); mout3 = rebuild(o3); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the output contains the right number of objects % 2) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check the number of outputs if numel(o1) ~=1, atest = false; end if numel(o2) ~=1, atest = false; end if numel(o3) ~=2, atest = false; end % Check the rebuilding of the object if ~eq(o1, mout1, ple2), atest = false; end if ~eq(o2, mout2, ple2), atest = false; end if ~eq(o3, mout3, ple2), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_09 %% UTP_10 % <TestDescription> % % Check that the split method accepts both key-words 'N' and 'chunks'. % % </TestDescription> function result = utp_10 % <SyntaxDescription> % % Check that the split method accepts both key-words 'N' and 'chunks'. % % </SyntaxDescription> try % <SyntaxCode> N = 4; plC = plist('chunks', N); plN = plist('N', N); outC = split(at5, plC); outN = split(at5, plN); moutC = rebuild(outC); moutN = rebuild(outN); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Check the number of outputs if numel(outC) ~= 4, atest = false; end if numel(outN) ~= 4, atest = false; end % Check that 'outN' and 'outC' are the same if ~eq(outN, outC,ple2), atest = false; end % Check the rebuilding of the object if ~eq(outC, moutC, ple2), atest = false; end if ~eq(outN, moutN, ple2), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_10 %% UTP_12 % <TestDescription> % % Tests that the split method works also split 'dx' and 'dy'. % % </TestDescription> function result = utp_12 % <SyntaxDescription> % % Tests that the split method works also split 'dx' and 'dy'. % % </SyntaxDescription> try % <SyntaxCode> N = 4; pl = plist('chunks', N); out = split(atmat, pl); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that each output AO contains the correct data. % % </AlgoDescription> atest = true; TOL = 1e-14; if stest % <AlgoCode> % Check we have the correct number of outputs if numel(out) ~= numel(atmat) * N, atest = false; end % Check each output for kk=1:numel(atmat) ff = floor(length(atmat(kk).y)/N); is = 1:ff:length(atmat(kk).y); ie = ff:ff:length(atmat(kk).y); idx = sort([is(1:N) ie(1:N)]); idx(end) = length(atmat(kk).y); for jj = 1:N % Get reference values x = atmat(kk).x; y = atmat(kk).y; % Get and normalize for tsdata the values if isa(atmat(kk).data, 'tsdata') t0off = (out((kk-1)*N+jj).t0.utc_epoch_milli - atmat(kk).t0.utc_epoch_milli)/1e3; ox = out((kk-1)*N+jj).x + t0off; else ox = out((kk-1)*N+jj).x; end oy = out((kk-1)*N+jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if ~isa(atmat(kk).data, 'cdata') if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end else if ~isequal(oy, y(range).'), atest = false; end end end end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_12 %% UTP_13 % <TestDescription> % % Check that the split method ignores the samples which doesn't fit. % % </TestDescription> function result = utp_13 % <SyntaxDescription> % % Check that the split method ignores the samples which doesn't fit. % Use for this test the key-word 'match' % % </SyntaxDescription> try % <SyntaxCode> N = 7; pl = plist('chunks', N, 'match', false); out = split(at5, pl); mout = rebuild(out); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check that the number of outputs % 2) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; TOL = 1e-14; if stest % <AlgoCode> % Check the number of outputs if numel(out) ~= N, atest = false; end % Check the output ff = floor(length(at5.y)/N); is = 1:ff:length(at5.y); ie = ff:ff:length(at5.y); idx = sort([is(1:N) ie(1:N)]); for jj = 1:N % Get reference values x = at5.x; y = at5.y; % Get and normalize for tsdata the values ox = out(jj).x + (out(jj).t0.utc_epoch_milli - at5.t0.utc_epoch_milli)/1000; oy = out(jj).y; % Compute the range range = idx(jj*2-1):idx(jj*2); % Check data if any(abs(ox - x(range)) > TOL), atest = false; end if ~isequal(oy, y(range)), atest = false; end end % Check the rebuilding of the object if ~eq(out, mout, ple2), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_13 %% UTP_15 % <TestDescription> % % Check that the split method works with notequal sampled data. % % </TestDescription> function result = utp_15 % <SyntaxDescription> % % Check that the split method works with notequal sampled data. % % </SyntaxDescription> try % <SyntaxCode> xOffset = 60; y = randn(2e3,1); x = [1:150 152:400 402:1019 1021:1999]; y = y(x); a1 = ao(plist('xvals', x, 'yvals', y, 'fs', 1, 'yunits', 'N')); a1.setXY(x + xOffset, y); a1.setT0(time('2009-11-03 18:00:00.000')); N = 5; pl1 = plist(... 'chunks', N, ... 'match', false); pl2 = plist(... 'chunks', N, ... 'match', true); out1 = split(a1, pl1); out2 = split(a1, pl2); mout1 = rebuild(out1); mout2 = rebuild(out2); % </SyntaxCode> stest = true; catch err disp(err.message) stest = false; end % <AlgoDescription> % % 1) Check the outputs % 2) Check that the 'rebuild' method produces the same object as 'out'. % % </AlgoDescription> atest = true; if stest % <AlgoCode> % Compute the starting point of the first data sample. firstX = 1:floor(a1.len/N):a1.len; firstX = a1.x(firstX(1:N)); % Check the number of outputs if numel(out1) ~= N, atest = false; end if numel(out2) ~= N, atest = false; end for jj = 1:numel(out1) % Check t0 if ~isequal(out1(jj).t0, a1.t0), atest = false; end % Check first x value if ~isequal(out1(jj).x(1), firstX(jj)), atest = false; end if ~isequal(out2(jj).x(1), firstX(jj)), atest = false; end % Check the rebuilding of the object if ~eq(out1(jj), mout1(jj), ple2), atest = false; end if ~eq(out2(jj), mout2(jj), ple2), atest = false; end end % Check length if ~isequal(sum(out2.len), a1.len), atest = false; end % </AlgoCode> else atest = false; end % Return a result structure result = utp_prepare_result(atest, stest, dbstack, mfilename); end % END UTP_15 end