line source
+ − % TEST_PEST_EVAL tests the eval method of the PEST class.
+ − %
+ − % M Hueller 02-03-10
+ − %
+ − % $Id: test_pest_eval.m,v 1.3 2010/03/19 11:13:17 mauro Exp $
+ − %
+ − function results = test_pest_eval(varargin)
+ −
+ − %% List of runs
+ − if nargin == 1
+ − list = varargin{1};
+ − if isa(list, 'cell')
+ − list = list{:};
+ − end
+ − else
+ − list = [];
+ − end
+ −
+ − if isempty(list)
+ − list = [10:17 20:27 30:37 40:47 60:67 80:87];
+ − end
+ −
+ − %% Prepare test data
+ − nsecs = 100;
+ − fs = 10;
+ −
+ − unit_list = unit.supportedUnits;
+ − u1 = unit(cell2mat(utils.math.randelement(unit_list,1)));
+ − u2 = unit(cell2mat(utils.math.randelement(unit_list,1)));
+ − u3 = unit(cell2mat(utils.math.randelement(unit_list,1)));
+ − u4 = unit(cell2mat(utils.math.randelement(unit_list,1)));
+ −
+ − pl1 = plist('nsecs', nsecs, 'fs', fs, ...
+ − 'tsfcn', 'polyval([10 1], t) + randn(size(t))', ...
+ − 'xunits', 's', 'yunits', u1);
+ −
+ − pl2 = plist('nsecs', nsecs, 'fs', fs, ...
+ − 'tsfcn', 'polyval([-5 0.2], t) + randn(size(t))', ...
+ − 'xunits', 's', 'yunits', u2);
+ −
+ − t1 = [0:5:200]';
+ − f1 = [1e-3:1e-3:0.1];
+ − z1 = [1e-2:1e-2:1];
+ −
+ − T1 = ao(t1, randn(size(t1)), plist('type', 'tsdata'));T1c = ao(t1);
+ − F1 = ao(f1, randn(size(f1)), plist('type', 'fsdata'));F1c = ao(f1);
+ − Z1 = ao(z1, randn(size(z1)), plist('type', 'xydata'));Z1c = ao(z1);
+ −
+ − a1 = ao(pl1);
+ − a2 = ao(pl2);
+ − a2b = ao(pl2);
+ − a3 = ao(plist('yvals', 2, 'yunits', u4))*a2 + ao(plist('yvals', -3, 'yunits', u4))*a2b;
+ −
+ − % Prepare some pest objects: single x
+ − p_1 = linfit(a1, plist());
+ − p_2 = linfit(a1, a2, plist());
+ −
+ − p_t = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('s') u3/unit('s^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*t + a2.*t.^2 + a0', 'xvar', 't', 'yunits', u3, 'xunits', 'ms'))) ...
+ − );
+ −
+ − p_f = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('Hz') u3/unit('Hz^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*f + a2.*f.^2 + a0', 'xvar', 'f', 'yunits', u3, 'xunits', 'kHz'))) ...
+ − );
+ −
+ − p_w = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('Hz') u3/unit('Hz^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*w + a2.*w.^2 + a0', 'xvar', 'w', 'yunits', u3, 'xunits', 'MHz'))) ...
+ − );
+ −
+ − p_z = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('') u3/unit('')}, ...
+ − 'models', smodel(plist('expression', 'a1.*z + a2.*z.^2 + a0', 'xvar', 'z', 'yunits', u3))) ...
+ − );
+ −
+ − % Prepare some pest objects: multiple x
+ − p_3 = bilinfit(a2, a2b, a3);
+ −
+ − p_tt = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('s') u3/unit('s^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*t1 + a2.*t2.^2 + a0', 'xvar', {'t1', 't2'}, 'yunits', u3, 'xunits', {'ms', 'ms'}))) ...
+ − );
+ −
+ − p_ff = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('Hz') u3/unit('Hz^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*f1 + a2.*f2.^2 + a0', 'xvar', {'f1', 'f2'}, 'yunits', u3, 'xunits', {'kHz', 'kHz'}))) ...
+ − );
+ −
+ − p_ww = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('Hz') u3/unit('Hz^2')}, ...
+ − 'models', smodel(plist('expression', 'a1.*w1 + a2.*w2.^2 + a0', 'xvar', {'w1', 'w2'}, 'yunits', u3, 'xunits', {'MHz', 'MHz'}))) ...
+ − );
+ −
+ − p_zz = pest(plist('paramnames', {'a0','a1','a2'}, 'y', [1 2 3], ...
+ − 'cov', [0.1 0.001 -0.001;0.001 0.1 -0.002;-0.001 -0.002 0.1;], ...
+ − 'dy', sqrt([0.1 0.1 0.1]), ...
+ − 'yunits', {u3, u3/unit('') u3/unit('')}, ...
+ − 'models', smodel(plist('expression', 'a1.*z1 + a2.*z2.^2 + a0', 'xvar', {'z1', 'z2'}, 'yunits', u3))) ...
+ − );
+ −
+ − %% Run tests
+ − results = [];
+ −
+ − %% 10) Single Xdata in plist, double, Xvar = x
+ − test = 10;
+ − if any(ismember(list, test))
+ − o = p_1.eval(plist(...
+ − 'Xdata', t1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', t1, 'xunits', a1.xunits, 'yunits', a1.yunits, 'dy', true))];
+ − end
+ −
+ − %% 11) Single Xdata in plist, double, Xvar = t
+ − test = 11;
+ − if any(ismember(list, test))
+ − o = p_t.eval(plist(...
+ − 'Xdata', t1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'tsdata', 'x', t1, 'xunits', p_t.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 12) Single Xdata in plist, double, Xvar = f
+ − test = 12;
+ − if any(ismember(list, test))
+ − o = p_f.eval(plist(...
+ − 'Xdata', f1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', f1, 'xunits', p_f.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 13) Single Xdata in plist, double, Xvar = w
+ − test = 13;
+ − if any(ismember(list, test))
+ − o = p_w.eval(plist(...
+ − 'Xdata', f1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', f1, 'xunits', p_w.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ − %% 14) Single Xdata in plist, double, Xvar = z, specify data type
+ − test = 14;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', t1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', t1, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 15) Single Xdata in plist, double, Xvar = z, specify data type
+ − test = 15;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', z1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', z1, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 16) Single Xdata in plist, double, Xvar = z, specify data type
+ − test = 16;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', z1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', z1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 17) Single Xdata in plist, double, Xvar = z, do not specify data type
+ − test = 17;
+ − if any(ismember(list, test))
+ − o = p_z.eval(plist(...
+ − 'Xdata', z1));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', z1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 20) Single Xdata in plist, ao, Xvar = x
+ − test = 20;
+ − if any(ismember(list, test))
+ − o = p_1.eval(plist(...
+ − 'Xdata', T1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', T1.x, 'xunits', a1.xunits, 'yunits', a1.yunits, 'dy', true))];
+ −
+ −
+ − o = p_1.eval(plist(...
+ − 'Xdata', T1c, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', T1c.y, 'xunits', a1.xunits, 'yunits', a1.yunits, 'dy', true))];
+ − end
+ −
+ − %% 21) Single Xdata in plist, ao, Xvar = t
+ − test = 21;
+ − if any(ismember(list, test))
+ − o = p_t.eval(plist(...
+ − 'Xdata', T1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'tsdata', 'x', T1.x, 'xunits', p_t.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_t.eval(plist(...
+ − 'Xdata', T1c, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'tsdata', 'x', T1c.y, 'xunits', p_t.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 22) Single Xdata in plist, ao, Xvar = f
+ − test = 22;
+ − if any(ismember(list, test))
+ − o = p_f.eval(plist(...
+ − 'Xdata', F1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1.x, 'xunits', p_f.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_f.eval(plist(...
+ − 'Xdata', F1c, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1c.y, 'xunits', p_f.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 23) Single Xdata in plist, ao, Xvar = w
+ − test = 23;
+ − if any(ismember(list, test))
+ − o = p_w.eval(plist(...
+ − 'Xdata', F1, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1.x, 'xunits', p_w.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_w.eval(plist(...
+ − 'Xdata', F1c, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1c.y, 'xunits', p_w.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 24) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 24;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', T1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', T1.x, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(plist(...
+ − 'Xdata', T1c, ...
+ − 'type', type));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', T1c.y, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 25) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 25;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1.x, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1c, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1c.y, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 26) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 26;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1.x, 'xunits', '', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1c, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1c.y, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 27) Single Xdata in plist, ao, Xvar = z, do not specify data type
+ − test = 27;
+ − if any(ismember(list, test))
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1.x, 'xunits', '', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(plist(...
+ − 'Xdata', Z1c));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1c.y, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 30) Multiple Xdata in plist, double, Xvar = x
+ − test = 30;
+ − if any(ismember(list, test))
+ − o = p_3.eval(plist(...
+ − 'Xdata', {t1, t1}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', t1, 'xunits', '', 'yunits', a3.yunits, 'dy', true))];
+ − end
+ −
+ − %% 31) Multiple Xdata in plist, double, Xvar = t, specify data type
+ − test = 31;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_tt.eval(plist(...
+ − 'Xdata', {t1 t1}, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', t1, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 32) Multiple Xdata in plist, double, Xvar = f, don't specify data type
+ − test = 32;
+ − if any(ismember(list, test))
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {f1 f1}, ...
+ − 'type', '' ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', f1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 33) Multiple Xdata in plist, double, Xvar = w, specify data type
+ − test = 33;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_ww.eval(plist(...
+ − 'Xdata', {f1 f1}, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', f1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 34) Multiple Xdata in plist, double, Xvar = z, specify data type
+ − test = 34;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {t1 t1}, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', t1, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 35) Multiple Xdata in plist, double, Xvar = z, specify data type
+ − test = 35;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {z1 z1}, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', z1, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 36) Multiple Xdata in plist, double, Xvar = z, specify data type
+ − test = 36;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {z1 z1}, ...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', z1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 37) Multiple Xdata in plist, double, Xvar = z, do not specify data type
+ − test = 37;
+ − if any(ismember(list, test))
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {z1 z1}));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', z1, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 40) Multiple Xdata in plist, ao, Xvar = x
+ − test = 40;
+ − if any(ismember(list, test))
+ − o = p_3.eval(plist(...
+ − 'Xdata', {T1, T1}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', a3.yunits, 'dy', true))];
+ −
+ − o = p_3.eval(plist(...
+ − 'Xdata', {T1c, T1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(... % No need to pass x & xunits in this case
+ − 'type', class(T1c.data), 'yunits', a3.yunits, 'dy', true))];
+ − end
+ −
+ − %% 41) Multiple Xdata in plist, ao, Xvar = t, specify data type
+ − test = 41;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_tt.eval(plist(...
+ − 'Xdata', {T1 T1}, ...
+ − 'type', type ... % This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_tt.eval(plist(...
+ − 'Xdata', {T1c, T1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(T1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 42) Multiple Xdata in plist, ao, Xvar = f, don't specify data type
+ − test = 42;
+ − if any(ismember(list, test))
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {F1 F1}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {F1c, F1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(F1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 43) Multiple Xdata in plist, ao, Xvar = w, specify data type
+ − test = 43;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_ww.eval(plist(...
+ − 'Xdata', {F1 F1}, ...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {F1c, F1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(F1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 44) Multiple Xdata in plist, ao, Xvar = z, specify data type
+ − test = 44;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {T1 T1}, ...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {T1c, T1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(T1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 45) Multiple Xdata in plist, ao, Xvar = z, specify data type
+ − test = 45;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {Z1 Z1}, ...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {Z1c, Z1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(Z1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 46) Multiple Xdata in plist, ao, Xvar = z, specify data type
+ − test = 46;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {Z1 Z1}, ...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval(plist(...
+ − 'Xdata', {Z1c, Z1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(Z1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 47) Multiple Xdata in plist, ao, Xvar = z, do not specify data type
+ − test = 47;
+ − if any(ismember(list, test))
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {Z1 Z1}));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval(plist(...
+ − 'Xdata', {Z1c, Z1c}, ...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(Z1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 50) Single Xdata in input, double, Xvar = x
+ − test = 50;
+ − if any(ismember(list, test))
+ − disp('Syntax not supported')
+ − end
+ −
+ − %% 60) Single Xdata in input, ao, Xvar = x
+ − test = 60;
+ − if any(ismember(list, test))
+ − o = p_1.eval(T1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', T1.x, 'xunits', a1.xunits, 'yunits', a1.yunits, 'dy', true))];
+ −
+ − o = p_1.eval(T1c, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', T1c.y, 'xunits', a1.xunits, 'yunits', a1.yunits, 'dy', true))];
+ − end
+ −
+ − %% 61) Single Xdata in input, ao, Xvar = t
+ − test = 61;
+ − if any(ismember(list, test))
+ − o = p_t.eval(T1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'tsdata', 'x', T1.x, 'xunits', p_t.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_t.eval(T1c, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'tsdata', 'x', T1c.y, 'xunits', p_t.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 62) Single Xdata in plist, ao, Xvar = f
+ − test = 62;
+ − if any(ismember(list, test))
+ − o = p_f.eval(F1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1.x, 'xunits', p_f.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_f.eval(F1c, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1c.y, 'xunits', p_f.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 63) Single Xdata in plist, ao, Xvar = w
+ − test = 63;
+ − if any(ismember(list, test))
+ − o = p_w.eval(F1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1.x, 'xunits', p_w.models.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_w.eval(F1c, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'fsdata', 'x', F1c.y, 'xunits', p_w.models.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 64) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 64;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_z.eval(T1, plist(...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', T1.x, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(T1c, plist(...
+ − 'type', type));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', T1c.y, 'xunits', 's', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 65) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 65;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_z.eval(Z1, plist(...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1.x, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(Z1c, plist(...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1c.y, 'xunits', 'Hz', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 66) Single Xdata in plist, ao, Xvar = z, specify data type
+ − test = 66;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_z.eval(Z1, plist(...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1.x, 'xunits', '', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(Z1c, plist(...
+ − 'type', type ...
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', type, 'x', Z1c.y, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 67) Single Xdata in plist, ao, Xvar = z, do not specify data type
+ − test = 67;
+ − if any(ismember(list, test))
+ − o = p_z.eval(Z1, plist());
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1.x, 'xunits', '', 'yunits', u3, 'dy', true))];
+ −
+ − o = p_z.eval(Z1c, plist());
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1c.y, 'xunits', '', 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 70) Multiple Xdata in input, double
+ − test = 70;
+ − if any(ismember(list, test))
+ − disp('Syntax not supported')
+ − end
+ −
+ − %% 80) Multiple Xdata in input, ao, Xvar = x
+ − test = 80;
+ − if any(ismember(list, test))
+ − o = p_3.eval(T1, T1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', a3.yunits, 'dy', true))];
+ −
+ − o = p_3.eval([T1 T1], plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', a3.yunits, 'dy', true))];
+ −
+ − end
+ −
+ − %% 81) Multiple Xdata in input, ao, Xvar = t, specify data type
+ − test = 81;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_tt.eval(T1, T1, plist(...
+ − 'type', type ... % This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_tt.eval([T1 T1], plist(...
+ − 'type', type ... % This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 82) Multiple Xdata in input, ao, Xvar = f, don't specify data type
+ − test = 82;
+ − if any(ismember(list, test))
+ − o = p_ff.eval(F1, F1, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ff.eval([F1 F1], plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 83) Multiple Xdata in input, ao, Xvar = w, specify data type
+ − test = 83;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_ww.eval(F1, F1, plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_ww.eval([F1 F1], plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(F1.data), 'x', F1.x, 'xunits', F1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 84) Multiple Xdata in input, ao, Xvar = z, specify data type
+ − test = 84;
+ − if any(ismember(list, test))
+ − type = 'tsdata';
+ − o = p_zz.eval(T1, T1, plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval([T1 T1], plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(T1.data), 'x', T1.x, 'xunits', T1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 85) Multiple Xdata in input, ao, Xvar = z, specify data type
+ − test = 85;
+ − if any(ismember(list, test))
+ − type = 'fsdata';
+ − o = p_zz.eval(Z1, Z1, plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval([Z1 Z1], plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 86) Multiple Xdata in plist, ao, Xvar = z, specify data type
+ − test = 86;
+ − if any(ismember(list, test))
+ − type = 'xydata';
+ − o = p_zz.eval(Z1, Z1, plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval([Z1 Z1], plist(...
+ − 'type', type ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', class(Z1.data), 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 87) Multiple Xdata in plist, ao, Xvar = z, do not specify data type
+ − test = 87;
+ − if any(ismember(list, test))
+ − o = p_zz.eval(Z1, Z1, plist());
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval([Z1 Z1], plist());
+ −
+ − results = [results; test check_correctness(o, plist(...
+ − 'type', 'xydata', 'x', Z1.x, 'xunits', Z1.xunits, 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval(Z1c, Z1c, plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(Z1c.data), 'yunits', u3, 'dy', true))];
+ −
+ − o = p_zz.eval([Z1c Z1c], plist(...
+ − 'type', '' ... %% This should be ignored
+ − ));
+ −
+ − results = [results; test check_correctness(o, plist(...% No need to pass x & xunits in this case
+ − 'type', class(Z1c.data), 'yunits', u3, 'dy', true))];
+ − end
+ −
+ − %% 90) Cases where we eval the x(s) in the models field (no input x)
+ −
+ − %% 100) An smodel with no xvar (should give cdata output)
+ −
+ − %% 110) Cases where we don't calculate dy
+ − end
+ −
+ − function atest = check_correctness(o, pl)
+ −
+ − % Exceptions plist for ao/eq
+ − ple = plist('Exceptions', ...
+ − {'created', 'proctime', 'UUID', 'param/desc', 'name', 'methodInvars', 'version'});
+ −
+ − % Start testing
+ − atest = true;
+ − % Check the output is of the proper type
+ − if ~isa (o.data, pl.find('type'))
+ − atest = false;
+ − end
+ − % Check the output x is the one provided (modulo the size, which is a problem of the "x" method)
+ − if ~isa(o.data, 'cdata')
+ − if ~isequal(size(o.x), size(pl.find('x')))
+ − if ~isequal(size(o.x'), size(pl.find('x')))
+ − atest = 0;
+ − else
+ − if ~isequal(o.x', pl.find('x'))
+ − atest = 0;
+ − end
+ − end
+ − else
+ − if ~isequal(o.x, pl.find('x'))
+ − atest = 0;
+ − end
+ − end
+ −
+ − % Check xunits
+ − if ~eq(o.xunits, unit(pl.find('xunits')))
+ − atest = false;
+ − end
+ − end
+ − % Check yunits
+ − if ~eq(o.yunits, unit(pl.find('yunits')))
+ − atest = false;
+ − end
+ − % Check uncertainty
+ − if isempty(o.dy)
+ − atest = false;
+ − end
+ − % Check rebuild
+ − if ~eq(o.rebuild, o, ple)
+ − atest = false;
+ − end
+ − end