44
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % UTP_AO_noisegen1D a set of UTPs for the ao/noisegen1D method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % L Ferraioli 16-02-09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % $Id: utp_ao_noisegen1D.m,v 1.13 2010/05/03 18:07:42 luigi Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % <MethodDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % The noisegen1D method of the ao class computes the noisegen1Dolute value of the y
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % and/or x data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % </MethodDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 function results = utp_ao_noisegen1D(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % Check the inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % Some keywords
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 class = 'ao';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 mthd = 'noisegen1D';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 results = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 disp(['**** Running UTPs for ' class '/' mthd]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % Test AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % [at1,at2,at3,at4,at5,at6,atvec,atmat] = get_test_objects_ao;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 [PSD,a1,a2,a3,a4,a5,av,am,plstd,plstd2] = get_test_obj_ao_noisegen1D();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % Exception list for the UTPs:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % add useful params to standard exceptions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 ple3 = plist('Exceptions', {'history', 'created', 'UUID', 'param/desc', 'name', 'procinfo'});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % % ---- Building fsdata model objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % pl_mod1 = plist('fsfcn', '0.01./(0.01+f)', 'f1', 1e-6, 'f2', 5, 'nf', 100);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % mod1 = ao(pl_mod1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % % ---- Building white noise test data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 % fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 % a3 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % a4 = ao(plist('tsfcn', 'randn(size(t))', 'fs', fs, 'nsecs', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % a5 = ao(plist('tsfcn', 'randn(size(t)).''', 'fs', fs, 'nsecs', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % av = [a1 a2 a3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % am = [a1 a2; a3 a4];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 % % ---- Building standard plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % plstd = plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 % 'model', mod1, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % 'MaxIter', 30, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % 'PoleType', 2, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % 'MinOrder', 10, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 % 'MaxOrder', 20, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % 'Weights', 2, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % 'Plot', false,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % 'Disp', false,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % 'RMSEVar', 5,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % 'FitTolerance', 2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % Run the tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 results = [results utp_01]; % getInfo call
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 results = [results utp_02]; % Vector input, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 results = [results utp_03]; % Matrix input, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 results = [results utp_04]; % List input, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 results = [results utp_05]; % Test with mixed input, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 results = [results utp_06]; % Test history is working, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 results = [results utp_07]; % Test the modify call works, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 results = [results utp_08]; % Test input data shape == output data shape, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 results = [results utp_09]; % Test output of the data, set 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 results = [results utp_10]; % Test history is working, set 'filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 results = [results utp_11]; % Test the modify call works, set 'filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 results = [results utp_12]; % Test output of the data, set 'Filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 disp('Done.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 elseif nargin == 1 % Check for UTP functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 if strcmp(varargin{1}, 'isutp')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 results = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 results = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 error('### Incorrect inputs')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 %% UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % Tests that the getInfo call works for this method.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 function result = utp_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 % Test that the getInfo call works for no sets, all sets, and each set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % individually.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 % Call for no sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 io(1) = eval([class '.getInfo(''' mthd ''', ''None'')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % Call for all sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 io(2) = eval([class '.getInfo(''' mthd ''')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 % Call for each set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 for kk=1:numel(io(2).sets)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 io(kk+2) = eval([class '.getInfo(''' mthd ''', ''' io(2).sets{kk} ''')']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % 1) Check that getInfo call returned an minfo object in all cases.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 % 2) Check that all plists have the correct parameters.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 % check we have minfo objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 if isa(io, 'minfo')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 %%% SET 'None'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 if ~isempty(io(1).sets), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 if ~isempty(io(1).plists), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 %%% Check all Sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 %%%%%%%%%% SET 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 if io(3).plists.nparams ~= 11, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if ~io(3).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 if ~io(3).plists.isparam('model'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 if ~io(3).plists.isparam('maxiter'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 if ~io(3).plists.isparam('poletype'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 if ~io(3).plists.isparam('minorder'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 if ~io(3).plists.isparam('maxorder'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 if ~io(3).plists.isparam('weights'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 if ~io(3).plists.isparam('plot'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 if ~io(3).plists.isparam('disp'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 if ~io(3).plists.isparam('msevartol'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 if ~io(3).plists.isparam('fittol'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 if ~isequal(io(3).plists.find('yunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 if ~isEmptyDouble(io(3).plists.find('model')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 if ~isequal(io(3).plists.find('maxiter'), 30), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 if ~isequal(io(3).plists.find('poletype'), 3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 if ~isequal(io(3).plists.find('minorder'), 2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 if ~isequal(io(3).plists.find('maxorder'), 25), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 if ~isequal(io(3).plists.find('weights'), 3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 if ~isequal(io(3).plists.find('plot'), false), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 if ~isequal(io(3).plists.find('disp'), false), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 if ~isequal(io(3).plists.find('msevartol'), .01), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 if ~isequal(io(3).plists.find('fittol'), .01), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 if ~isequal(io(3).plists.getOptionsForParam('yunits'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 if ~isequal(io(3).plists.getOptionsForParam('model'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 if ~isequal(io(3).plists.getOptionsForParam('maxiter'), {30}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 if ~isequal(io(3).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 if ~isequal(io(3).plists.getOptionsForParam('minorder'), {2}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 if ~isequal(io(3).plists.getOptionsForParam('maxorder'), {25}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 if ~isequal(io(3).plists.getOptionsForParam('weights'), {3}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 if ~isequal(io(3).plists.getOptionsForParam('plot'), {false, true}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 if ~isequal(io(3).plists.getOptionsForParam('disp'), {false, true}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 if ~isequal(io(3).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 if ~isequal(io(3).plists.getOptionsForParam('fittol'), {.01}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 %%%%%%%%%% SET 'Filter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 if io(4).plists.nparams ~= 12, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 if ~io(4).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 if ~io(4).plists.isparam('Iunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 if ~io(4).plists.isparam('Ounits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 if ~io(4).plists.isparam('maxiter'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 if ~io(4).plists.isparam('poletype'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 if ~io(4).plists.isparam('minorder'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 if ~io(4).plists.isparam('maxorder'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 if ~io(4).plists.isparam('weights'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 if ~io(4).plists.isparam('plot'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 if ~io(4).plists.isparam('disp'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 if ~io(4).plists.isparam('msevartol'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 if ~io(4).plists.isparam('fittol'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 if ~isequal(io(4).plists.find('fs'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 if ~isequal(io(4).plists.find('Iunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 if ~isequal(io(4).plists.find('Ounits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 if ~isequal(io(4).plists.find('maxiter'), 30), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 if ~isequal(io(4).plists.find('poletype'), 3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 if ~isequal(io(4).plists.find('minorder'), 2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 if ~isequal(io(4).plists.find('maxorder'), 25), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 if ~isequal(io(4).plists.find('weights'), 3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 if ~isequal(io(4).plists.find('plot'), false), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 if ~isequal(io(4).plists.find('disp'), false), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 if ~isequal(io(4).plists.find('msevartol'), .01), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 if ~isequal(io(4).plists.find('fittol'), .01), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 if ~isequal(io(4).plists.getOptionsForParam('fs'), {1}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 if ~isequal(io(4).plists.getOptionsForParam('Iunits'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 if ~isequal(io(4).plists.getOptionsForParam('Ounits'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 if ~isequal(io(4).plists.getOptionsForParam('maxiter'), {30}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 if ~isequal(io(4).plists.getOptionsForParam('poletype'), {1 2 3}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 if ~isequal(io(4).plists.getOptionsForParam('minorder'), {2}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 if ~isequal(io(4).plists.getOptionsForParam('maxorder'), {25}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 if ~isequal(io(4).plists.getOptionsForParam('weights'), {3}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 if ~isequal(io(4).plists.getOptionsForParam('plot'), {false, true}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 if ~isequal(io(4).plists.getOptionsForParam('disp'), {false, true}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 if ~isequal(io(4).plists.getOptionsForParam('msevartol'), {.01}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 if ~isequal(io(4).plists.getOptionsForParam('fittol'), {.01}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 end % END UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 %% UTP_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 % Tests that the noisegen1D method works with a vector of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 function result = utp_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 % Test that the noisegen1D method works for a vector of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 out = noisegen1D(av, plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 % 1) Check that the number of elements in 'out' is the same as in 'av'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 % 2) Check that each output AO contains the correct data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 % Check we have the correct number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 if ~isequal(size(out), size(av)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 % Check each output against the absolute value of the input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 for kk=1:numel(out)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 % Check the whiten ao(tsdata) objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 if isa(out(kk).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 used_filt = out(kk).procinfo.find('filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 obj = av(kk).filter(used_filt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 if ~eq(out(kk), obj, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 % Check the other objects (they must be the same)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 if ~eq(out(kk), av(kk), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 end % END UTP_02
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 %% UTP_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 % Tests that the noisegen1D method works with a matrix of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 function result = utp_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 % Test that the noisegen1D method works for a matrix of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 out = noisegen1D(am, plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 % 1) Check that the number of elements in 'out' is the same as in 'atmat'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 % 2) Check that each output AO contains the correct data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 % Check we have the correct number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 if ~isequal(size(out), size(am)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 % Check each output against the absolute value of the input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 for kk=1:numel(out)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 % Check the whiten ao(tsdata) objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 if isa(out(kk).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 used_filt = out(kk).procinfo.find('filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 obj = am(kk).filter(used_filt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 if ~eq(out(kk), obj, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 % Check the other objects (they must be the same)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 if ~eq(out(kk), am(kk), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 end % END UTP_03
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 %% UTP_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 % Tests that the noisegen1D method works with a list of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 function result = utp_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % Test that the noisegen1D method works for a list of AOs as input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 out = noisegen1D(a1,a2,a3,plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 % 1) Check that the number of elements in 'out' is the same as in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 % 2) Check that each output AO contains the correct data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 aoin = [a1,a2,a3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 % Check we have the correct number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 if ~isequal(size(out), size(aoin)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 % Check each output against the absolute value of the input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 for kk=1:numel(out)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 % Check the whiten ao(tsdata) objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 if isa(out(kk).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 used_filt = out(kk).procinfo.find('filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 obj = aoin(kk).filter(used_filt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 if ~eq(out(kk), obj, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 % Check the other objects (they must be the same)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 if ~eq(out(kk), aoin(kk), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 end % END UTP_04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 %% UTP_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 % Tests that the noisegen1D method works with a mix of different shaped AOs as
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 function result = utp_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 % Test that the noisegen1D method works with an input of matrices and vectors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 % and single AOs.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 out = noisegen1D(a5,[a1 a3],[a1 a2; a3 a4],plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 % 1) Check that the number of elements in 'out' is the same as in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 % input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 % 2) Check that each output AO contains the correct data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 aoin = [a5,reshape([a1 a3],1,[]),reshape([a1 a2; a3 a4],1,[])];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 % Check we have the correct number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 if ~isequal(size(out), size(aoin)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 % Check each output against the absolute value of the input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 for kk=1:numel(out)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 % Check the whiten ao(tsdata) objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 if isa(out(kk).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 used_filt = out(kk).procinfo.find('filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 obj = aoin(kk).filter(used_filt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 if ~eq(out(kk), obj, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 % Check the other objects (they must be the same)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 if ~eq(out(kk), aoin(kk), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 end % END UTP_05
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 %% UTP_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 % Tests that the noisegen1D method properly applies history.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 function result = utp_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 % Test that the result of applying the noisegen1D method can be processed back.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 out = noisegen1D(a1,plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 % 'noisegen1D'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 % 2) Check that the re-built object is the same object as the input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 if ~strcmp(out.hist.methodInfo.mname, 'noisegen1D'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 % Check the re-built object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 if ~eq(mout, out, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 end % END UTP_06
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 %% UTP_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 % Tests that the noisegen1D method can modify the input AO.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 function result = utp_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 % Test that the noisegen1D method can modify the input AO by calling with no
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 % output and that the method doesn't change the input of the function
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 % notation (with a equal sign).
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 amodi = ao(a1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 aeq = ao(a1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 out = aeq.noisegen1D(plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 amodi.noisegen1D(plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 % 1) Check that 'out' and 'aeq' are now different.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 % 2) Check that 'aeq' is not changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 % 3) Check that the modified input is changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 % Check that 'out' and 'aeq' are now different.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 if eq(out, aeq, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 % Check that 'aeq' is not changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 if ~eq(aeq, ao(a1), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 % Check that the modified input is changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 used_filt = amodi.procinfo.find('filter');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 ref = a1.filter(used_filt);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 if ~eq(ref, amodi, ple3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 end % END UTP_07
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 %% UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 % Test the shape of the output.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 function result = utp_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 % Test that the noisegen1D method keeps the data shape of the input object. The
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 % input AO must be an AO with row data and an AO with column data.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 out1 = noisegen1D(a4,plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 out2 = noisegen1D(a5,plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 % 1) Check that the shape of the data doesn't change.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 % Check the shape of the output data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 if size(out1.data.x) ~= size(a4.data.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 if size(out1.data.y) ~= size(a4.data.y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 if size(out2.data.x) ~= size(a5.data.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 if size(out2.data.y) ~= size(a5.data.y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 end % END UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629 %% UTP_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 % Check that the noisegen1D method pass back the output objects to a list of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 % output variables or to a single variable.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 function result = utp_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 % Call the method with a list of output variables and with a single output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 % variable. Additionaly check that the rebuild method works on the output.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 [o1, o2] = noisegen1D(a1, a2, plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 o3 = noisegen1D(a1, a2, plstd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 mout1 = rebuild(o1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 mout2 = rebuild(o2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 o31 = o3.index(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 o32 = o3.index(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 mout31 = rebuild(o31);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 mout32 = rebuild(o32);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 % 1) Check that the output contains the right number of objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 % 2) Check that the 'rebuild' method produces the same object as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 % Check the number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674 if numel(o1) ~=1, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 if numel(o2) ~=1, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 if numel(o3) ~=2, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 % Check the rebuilding of the object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 if ~eq(o1, mout1, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 if ~eq(o2, mout2, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 if ~eq(o31, mout31, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 if ~eq(o32, mout32, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 end % END UTP_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 %% UTP_10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 % Tests that the noisegen1D method properly applies history for set filter.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 function result = utp_10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 % Test that the result of applying the noisegen1D method can be processed back.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 out = noisegen1D(PSD,plstd2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 % 'noisegen1D'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 % 2) Check that the re-built object is the same object as the input.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729 if ~strcmp(out.hist.methodInfo.mname, 'noisegen1D'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 % Check the re-built object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731 if ~eq(mout, out, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 end % END UTP_10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741 %% UTP_10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 % Tests that the noisegen1D method can modify the input AO for set 'filter'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 function result = utp_11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 % Test that the noisegen1D method can modify the input AO by calling with no
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 % output and that the method doesn't change the input of the function
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 % notation (with a equal sign).
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 amodi = ao(PSD);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 aeq = ao(PSD);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 out = aeq.noisegen1D(plstd2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 amodi.noisegen1D(plstd2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 % 1) Check that 'out' and 'aeq' are now different.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 % 2) Check that 'aeq' is not changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 % Check that 'out' and 'aeq' are now different.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 if eq(out, aeq, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 % Check that 'aeq' is not changed
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 if ~eq(aeq, ao(PSD), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 end % END UTP_11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 %% UTP_12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 % Check that the noisegen1D method pass back the output objects to a list of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 % output variables or to a single variable.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802 function result = utp_12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 % Call the method with a list of output variables and with a single output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 % variable. Additionaly check that the rebuild method works on the output.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813 [o1, o2] = noisegen1D(PSD, PSD, plstd2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814 o3 = noisegen1D(PSD, PSD, plstd2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 mout1 = rebuild(o1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 mout2 = rebuild(o2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817 o31 = o3.index(1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818 o32 = o3.index(2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 mout31 = rebuild(o31);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820 mout32 = rebuild(o32);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
823 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
824 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
825 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 % 1) Check that the output contains the right number of objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831 % 2) Check that the 'rebuild' method produces the same object as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 % Check the number of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839 if numel(o1) ~=1, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840 if numel(o2) ~=1, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 if numel(o3) ~=2, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842 % Check the rebuilding of the object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 if ~eq(o1, mout1, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844 if ~eq(o2, mout2, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845 if ~eq(o31, mout31, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846 if ~eq(o32, mout32, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
849 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
850 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
851
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
852 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
853 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
854 end % END UTP_12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
855
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
856
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
857 end
|