44
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % UTP_AO_AO a set of UTPs for the ao/ao method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % M Hewitson 06-08-08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % $Id: utp_ao_ao.m,v 1.73 2011/08/15 10:44:51 hewitson 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 ao method of the ao class constructs AOs.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % </MethodDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 function results = utp_ao_ao(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % Check the inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % Some keywords
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 class = 'ao';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 mthd = 'ao';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 results = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 disp(['**** Running UTPs for ' class '/' mthd]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % Test AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 [at1,at2,at3,at4,at5,at6,atvec,atmat] = eval(['get_test_objects_' class]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % Exception list for the UTPs:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 [ple1,ple2,ple3,ple4,ple5,ple6] = get_test_ples();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % Define THRESHOLD for computing error
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 TOL = 1e-14;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % Run the tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 results = [results utp_01]; % getInfo call
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 results = [results utp_02(mthd, atvec, [], [], ple3)]; % Vector input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 results = [results utp_03(mthd, atmat, [], [], ple3)]; % Matrix input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 results = [results utp_04(mthd, at1, at2, at3, [], [], ple3)]; % List input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 results = [results utp_05(mthd, at1, atvec, atmat, [], [], ple3)]; % Test with mixed input
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 results = [results utp_06(mthd, at1, [], ple2)]; % Test history is working
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % Old format
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 results = [results utp_08]; % Test history is working with ASCII file constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 results = [results utp_09]; % Test history is working with complex ASCII file constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 results = [results utp_13]; % Test history is working with vals constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 results = [results utp_15]; % Test history is working with plist(fcn) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 results = [results utp_16]; % Test history is working with plist(vals) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 results = [results utp_17]; % Test history is working with plist(x/y-vals) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 results = [results utp_18]; % Test history is working with plist(tsfcn) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 results = [results utp_19]; % Test history is working with plist(fsfcn) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 results = [results utp_20]; % Test history is working with plist(win) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 results = [results utp_21]; % Test history is working with plist(waveform) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 results = [results utp_23]; % Test history is working with plist(polynomial) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 results = [results utp_25]; % Test history is working with specwin constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 results = [results utp_26]; % Test history is working with data-objects constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 results = [results utp_28]; % Test history is working with x-vector, y-vector constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 results = [results utp_29]; % Test history is working with filename + plist constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 results = [results utp_30]; % Test history is working with filename + plist constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 results = [results utp_31]; % Test history is working with filename + plist constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % constructor specific tests
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 results = [results utp_60(class, at3, ple2)]; % Test history is properly handled with MAT file constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 results = [results utp_61(class, at1, ple2)]; % Test history is properly handled with XML file constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 results = [results utp_62(class, at1, at2, ple2)]; % Test history is working with struct constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 % results = [results utp_63(class, ple1)]; % Test history is working with pzmodel-object constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 results = [results utp_64(class, at1, ple1, ple2)]; % Test history is working with plist(filename) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 results = [results utp_65(class, at1, ple3)]; % Test history is working with plist(hostname) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 results = [results utp_66(class, ple1)]; % Test history is working with plist(pzmodel) constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 results = [results utp_67(class, ple1)]; % Test history is working with pzmodel + plist constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 results = [results utp_68(class, at1, ple3)]; % Test history is working with conn+Id constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 disp('Done.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 disp('******************************************************');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 elseif nargin == 1 % Check for UTP functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 if strcmp(varargin{1}, 'isutp')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 results = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 elseif strcmpi(varargin{1}, 'needs repository')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 results = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 results = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 error('### Incorrect inputs')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 %% UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 % Tests that the getInfo call works for this method.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 function result = utp_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % Test that the getInfo call works for no sets, all sets, and each set
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 % individually.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 msg = '';
|
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 msg = err.message;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 % 1) Check that getInfo call returned an minfo object in all cases.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 % 2) Check that all plists have the correct parameters.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 % check we have minfo objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 if isa(io, 'minfo')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 prefs = getappdata(0, 'LTPDApreferences');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 % SET 'None'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 if ~isempty(io(1).sets), atest = false; msg = 'Sets ''None'' isn''t empty.'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 if ~isempty(io(1).plists), atest = false; msg = 'First plist for all sets isn''t empty.'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 % Check number of SETS
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 if numel(io(2).sets) ~= 21, atest = false; msg = 'Number of sets is wrong'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 % Check all Sets
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if ~any(strcmpi(io(2).sets, 'Default')), atest = false; msg = 'Sets array does not contain ''Default'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 if ~any(strcmpi(io(2).sets, 'From MAT File')), atest = false; msg = 'Sets array does not contain ''From MAT File'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 if ~any(strcmpi(io(2).sets, 'From XML File')), atest = false; msg = 'Sets array does not contain ''From XML File'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 if ~any(strcmpi(io(2).sets, 'From Repository')), atest = false; msg = 'Sets array does not contain ''From Repository'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 if ~any(strcmpi(io(2).sets, 'From Built-in model')), atest = false; msg = 'Sets array does not contain ''From Built-in Model'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 if ~any(strcmpi(io(2).sets, 'From MAT Data File')), atest = false; msg = 'Sets array does not contain ''From MAT Data File'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 if ~any(strcmpi(io(2).sets, 'From ASCII File')), atest = false; msg = 'Sets array does not contain ''From ASCII File'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 if ~any(strcmpi(io(2).sets, 'From Complex ASCII File')), atest = false; msg = 'Sets array does not contain ''From Complex ASCII File'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 if ~any(strcmpi(io(2).sets, 'From Function')), atest = false; msg = 'Sets array does not contain ''From Function'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 if ~any(strcmpi(io(2).sets, 'From Values')), atest = false; msg = 'Sets array does not contain ''From Values'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 if ~any(strcmpi(io(2).sets, 'From XY Values')), atest = false; msg = 'Sets array does not contain ''From XY Values''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 if ~any(strcmpi(io(2).sets, 'From Time-series Function')), atest = false; msg = 'Sets array does not contain ''From Time-series Function'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 if ~any(strcmpi(io(2).sets, 'From XY Function')), atest = false; msg = 'Sets array does not contain ''From XY Function'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 if ~any(strcmpi(io(2).sets, 'From Frequency-series Function')), atest = false; msg = 'Sets array does not contain ''From Frequency-series Function'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 if ~any(strcmpi(io(2).sets, 'From Window')), atest = false; msg = 'Sets array does not contain ''From Window'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 if ~any(strcmpi(io(2).sets, 'From Waveform')), atest = false; msg = 'Sets array does not contain ''From Waveform''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 if ~any(strcmpi(io(2).sets, 'From Polynomial')), atest = false; msg = 'Sets array does not contain ''From Polynomial''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 if ~any(strcmpi(io(2).sets, 'From Pzmodel')), atest = false; msg = 'Sets array does not contain ''From Pzmodel''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 if ~any(strcmpi(io(2).sets, 'From smodel')), atest = false; msg = 'Sets array does not contain ''From smodel''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 if ~any(strcmpi(io(2).sets, 'From pest')), atest = false; msg = 'Sets array does not contain ''From pest''';end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 if ~any(strcmpi(io(2).sets, 'From Parameter')), atest = false; msg = 'Sets array does not contain ''From Parameter'''; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 if numel(io(2).plists) ~= numel(io(2).sets), atest = false; msg = 'Number of plists does not match number of sets'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 %%%%%%%%%% SET 'Default'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 pn = 3;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 [atest, msg] = checkParamNumber(io, pn, 3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 %%%%%%%%%% SET 'From MAT File'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 pn = 4;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 [atest, msg] = checkParamNumber(io, pn, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 if ~io(pn).plists.isparam('filename'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %%%%%%%%%% SET 'From XML File'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 pn = 5;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 [atest, msg] = checkParamNumber(io, pn, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 if ~io(pn).plists.isparam('filename'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 %%%%%%%%%% SET 'From Repository'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 pn = 6;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 [atest, msg] = checkParamNumber(io, pn, 7);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 if ~io(pn).plists.isparam('hostname'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 if ~io(pn).plists.isparam('id'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 if ~io(pn).plists.isparam('cid'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 if ~io(pn).plists.isparam('database'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 if ~io(pn).plists.isparam('binary'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 if ~io(pn).plists.isparam('username'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 if ~io(pn).plists.isparam('password'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 if ~isEmptyDouble(io(pn).plists.find('id')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 if ~isEmptyDouble(io(pn).plists.find('cid')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 if ~isequal(io(pn).plists.find('binary'), 'yes'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 if ~isequal(io(pn).plists.getOptionsForParam('id'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 if ~isequal(io(pn).plists.getOptionsForParam('cid'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 if ~isequal(io(pn).plists.getOptionsForParam('binary'), {'yes', 'no'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 %%%%%%%%%% SET 'From Built-in model'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 pn = 7;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 [atest, msg] = checkParamNumber(io, pn, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 if ~io(pn).plists.isparam('built-in'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 if ~isEmptyChar(io(pn).plists.find('built-in')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 if ~isequal(io(pn).plists.getOptionsForParam('built-in'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 %%%%%%%%%% SET 'From MAT Data File'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 pn = 8;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 [atest, msg] = checkParamNumber(io, pn, 9);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 if ~io(pn).plists.isparam('filename'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 if ~io(pn).plists.isparam('columns'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 if ~isEmptyChar(io(pn).plists.find('name')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 if ~isequal(io(pn).plists.find('type'), 'cdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 if ~isEmptyDouble(io(pn).plists.find('columns')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 if ~isequal(io(pn).plists.getOptionsForParam('description'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 % not sure how to test this
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 %%%%%%%%%% SET 'From ASCII File'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 pn = 9;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 [atest, msg] = checkParamNumber(io, pn, 14);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 if ~io(pn).plists.isparam('filename'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 if ~io(pn).plists.isparam('columns'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 if ~io(pn).plists.isparam('comment_char'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 if ~io(pn).plists.isparam('maxlines'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 if ~io(pn).plists.isparam('robust'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 if ~io(pn).plists.isparam('delimiter'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 if ~isequal(io(pn).plists.find('name'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 if ~isEmptyChar(io(pn).plists.find('description')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 if ~isEmptyDouble(io(pn).plists.find('plotinfo')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 if ~isequal(io(pn).plists.find('type'), 'cdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 if ~isEmptyDouble(io(pn).plists.find('columns')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 if ~isEmptyChar(io(pn).plists.find('xunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 if ~isEmptyChar(io(pn).plists.find('comment_char')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 if ~isEmptyDouble(io(pn).plists.find('maxlines')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 if ~isequal(io(pn).plists.find('robust'), 'no'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 if ~isequal(io(pn).plists.find('delimiter'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 if ~isequal(io(pn).plists.getOptionsForParam('name'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 if ~isequal(io(pn).plists.getOptionsForParam('description'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 % not sure how to test this
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 if ~isequal(io(pn).plists.getOptionsForParam('comment_char'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 if ~isequal(io(pn).plists.getOptionsForParam('maxlines'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 if ~isequal(io(pn).plists.getOptionsForParam('robust'), {'yes', 'no'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 if ~isequal(io(pn).plists.getOptionsForParam('delimiter'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 %%%%%%%%%% SET 'From Complex ASCII File'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 pn = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 [atest, msg] = checkParamNumber(io, pn, 11);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 if ~io(pn).plists.isparam('filename'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 if ~io(pn).plists.isparam('complex_type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 if ~io(pn).plists.isparam('columns'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 if ~io(pn).plists.isparam('comment_char'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 if ~isEmptyChar(io(pn).plists.find('filename')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 if ~strcmp(io(pn).plists.find('complex_type'), 'real/imag'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 if ~strcmp(io(pn).plists.find('type'), 'fsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 if ~isequal(io(pn).plists.find('columns'), [1 2 3]), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 if ~isequal(io(pn).plists.find('xunits'), 'Hz'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 if ~isEmptyChar(io(pn).plists.find('comment_char')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 if ~isequal(io(pn).plists.getOptionsForParam('filename'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 if ~isequal(io(pn).plists.getOptionsForParam('complex_type'), { 'real/imag', 'abs/deg', 'dB/deg', 'abs/rad', 'dB/rad'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 if ~isequal(io(pn).plists.getOptionsForParam('columns'), {[1 2 3]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'Hz'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 if ~isequal(io(pn).plists.getOptionsForParam('comment_char'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 %%%%%%%%%% SET 'From Function'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 pn = 11;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 [atest, msg] = checkParamNumber(io, pn, 5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 if ~io(pn).plists.isparam('fcn'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 if ~isEmptyChar(io(pn).plists.find('fcn')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 if ~isequal(io(pn).plists.getOptionsForParam('fcn'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 %%%%%%%%%% SET 'From Values'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 pn = 12;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 [atest, msg] = checkParamNumber(io, pn, 6);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 if ~io(pn).plists.isparam('vals'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 if ~io(pn).plists.isparam('n'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 if ~isEmptyDouble(io(pn).plists.find('vals')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 if ~isequal(io(pn).plists.find('n'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 if ~isequal(io(pn).plists.getOptionsForParam('vals'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 if ~isequal(io(pn).plists.getOptionsForParam('n'), {[1]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 %%%%%%%%%% SET 'From XY Values'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 pn = 13;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 [atest, msg] = checkParamNumber(io, pn, 11);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 if ~io(pn).plists.isparam('toffset'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 if ~io(pn).plists.isparam('xvals'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 if ~io(pn).plists.isparam('yvals'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 if ~isequal(io(pn).plists.find('type'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 if ~isequal(io(pn).plists.find('toffset'), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 if ~isEmptyDouble(io(pn).plists.find('xvals')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 if ~isEmptyDouble(io(pn).plists.find('yvals')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 if ~isEmptyChar(io(pn).plists.find('xunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'', 'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 if ~isequal(io(pn).plists.getOptionsForParam('xvals'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 if ~isequal(io(pn).plists.getOptionsForParam('yvals'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 %%%%%%%%%% SET 'From Time-series Function'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 pn = 14;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 [atest, msg] = checkParamNumber(io, pn, 9);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 if ~io(pn).plists.isparam('tsfcn'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 if ~io(pn).plists.isparam('nsecs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 if ~isequal(io(pn).plists.find('tsfcn'), 't'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 if ~isequal(double(time(io(pn).plists.find('t0'))), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 if ~isequal(io(pn).plists.getOptionsForParam('tsfcn'), {'t'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 %%%%%%%%%% SET 'From XY Function'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 pn = 15;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 [atest, msg] = checkParamNumber(io, pn, 7);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 if ~io(pn).plists.isparam('xyfcn'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 if ~io(pn).plists.isparam('x'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 if ~isequal(io(pn).plists.find('xyfcn'), 'x'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 if ~isequal(io(pn).plists.find('xunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 if ~isequal(io(pn).plists.getOptionsForParam('xyfcn'), {'x'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 %%%%%%%%%% SET 'From Frequency-series Function'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 pn = 16;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 [atest, msg] = checkParamNumber(io, pn, 11);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 if ~io(pn).plists.isparam('fsfcn'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 if ~io(pn).plists.isparam('f1'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 if ~io(pn).plists.isparam('f2'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 if ~io(pn).plists.isparam('nf'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 if ~io(pn).plists.isparam('scale'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 if ~io(pn).plists.isparam('f'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 if ~isequal(io(pn).plists.find('fsfcn'), 'f'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 if ~isequal(io(pn).plists.find('f1'), 1e-9), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 if ~isequal(io(pn).plists.find('f2'), 10000), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 if ~isequal(io(pn).plists.find('nf'), 1e3), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 if ~isequal(io(pn).plists.find('scale'), 'log'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 if ~isEmptyDouble(io(pn).plists.find('f')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 if ~isequal(io(pn).plists.find('xunits'), 'Hz'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 if ~isequal(io(pn).plists.getOptionsForParam('fsfcn'), {'f'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 if ~isequal(io(pn).plists.getOptionsForParam('f1'), {1e-9}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 if ~isequal(io(pn).plists.getOptionsForParam('f2'), {1e4}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 if ~isequal(io(pn).plists.getOptionsForParam('nf'), {1e3}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 if ~isequal(io(pn).plists.getOptionsForParam('scale'), {'lin', 'log'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 if ~isequal(io(pn).plists.getOptionsForParam('f'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'Hz'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 %%%%%%%%%% SET 'From Window'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 pn = 17;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 [atest, msg] = checkParamNumber(io, pn, 8);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 if ~io(pn).plists.isparam('win'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 if ~io(pn).plists.isparam('length'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 if ~io(pn).plists.isparam('psll'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490 if ~io(pn).plists.isparam('levelorder'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493 if ~strcmpi(io(pn).plists.find('win'), char(prefs.getMiscPrefs.getDefaultWindow)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 if ~isequal(io(pn).plists.getOptionsForParam('win'), specwin.getTypes), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 %%%%%%%%%% SET 'From Waveform'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 pn = 18;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 [atest, msg] = checkParamNumber(io, pn, 22);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 if ~io(pn).plists.isparam('waveform'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 if ~io(pn).plists.isparam('a'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 if ~io(pn).plists.isparam('f'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 if ~io(pn).plists.isparam('phi'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509 if ~io(pn).plists.isparam('toff'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 if ~io(pn).plists.isparam('gaps'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 if ~io(pn).plists.isparam('sigma'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 if ~io(pn).plists.isparam('f0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 if ~io(pn).plists.isparam('f1'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 if ~io(pn).plists.isparam('t1'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 if ~io(pn).plists.isparam('bw'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 if ~io(pn).plists.isparam('duty'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 if ~io(pn).plists.isparam('width'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 if ~io(pn).plists.isparam('nsecs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 if ~isequal(io(pn).plists.find('waveform'), 'sine wave'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 if ~isequal(io(pn).plists.find('a'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 if ~isequal(io(pn).plists.find('f'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 if ~isequal(io(pn).plists.find('phi'), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 if ~isequal(io(pn).plists.find('toff'), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 if ~isEmptyDouble(io(pn).plists.find('gaps')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 if ~isequal(io(pn).plists.find('type'), 'Normal'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 if ~isequal(io(pn).plists.find('sigma'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 if ~isequal(io(pn).plists.find('f0'), 1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 if ~isEmptyDouble(io(pn).plists.find('f1')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 if ~isEmptyDouble(io(pn).plists.find('t1')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 if ~isEmptyDouble(io(pn).plists.find('bw')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 if ~isequal(io(pn).plists.find('duty'), 50), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 if ~isequal(io(pn).plists.find('width'), 0.5), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 if ~isequal(double(time(io(pn).plists.getOptionsForParam('t0'))), 0), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 if ~isequal(io(pn).plists.find('yunits'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 if ~isequal(io(pn).plists.getOptionsForParam('waveform'), {'sine wave', 'noise', 'chirp', 'gaussian pulse', 'square wave', 'sawtooth'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 if ~isequal(io(pn).plists.getOptionsForParam('a'), {1}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 if ~isequal(io(pn).plists.getOptionsForParam('f'), {1}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 if ~isequal(io(pn).plists.getOptionsForParam('phi'), {0}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 if ~isequal(io(pn).plists.getOptionsForParam('toff'), {0}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 if ~isequal(io(pn).plists.getOptionsForParam('gaps'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'Normal', 'Uniform'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552 if ~isequal(io(pn).plists.getOptionsForParam('sigma'), {1}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 if ~isequal(io(pn).plists.getOptionsForParam('f0'), {1}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 if ~isequal(io(pn).plists.getOptionsForParam('f1'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 if ~isequal(io(pn).plists.getOptionsForParam('t1'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 if ~isequal(io(pn).plists.getOptionsForParam('bw'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 if ~isequal(io(pn).plists.getOptionsForParam('duty'), {50}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 if ~isequal(io(pn).plists.getOptionsForParam('width'), {0.5}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 %%%%%%%%%% SET 'From Polynomial'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 pn = 19;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566 [atest, msg] = checkParamNumber(io, pn, 13);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 if ~io(pn).plists.isparam('polyval'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 if ~io(pn).plists.isparam('nsecs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 if ~io(pn).plists.isparam('t'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576 if ~io(pn).plists.isparam('x'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 if ~io(pn).plists.isparam('f'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 if ~isEmptyDouble(io(pn).plists.find('polyval')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 if ~isEmptyDouble(io(pn).plists.find('t')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 if ~isEmptyDouble(io(pn).plists.find('f')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589 if ~isequal(io(pn).plists.find('type'), 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593 if ~isequal(io(pn).plists.getOptionsForParam('polyval'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 if ~isequal(io(pn).plists.getOptionsForParam('t'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598 if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 if ~isequal(io(pn).plists.getOptionsForParam('f'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 %%%%%%%%%% SET 'From Pzmodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 pn = 20;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605 [atest, msg] = checkParamNumber(io, pn, 9);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610 if ~io(pn).plists.isparam('pzmodel'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 if ~io(pn).plists.isparam('nsecs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 if ~io(pn).plists.isparam('fs'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 if ~io(pn).plists.isparam('t0'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 if ~io(pn).plists.isparam('yunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 if ~eq(io(pn).plists.find('pzmodel'), pzmodel(), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 if ~isEmptyDouble(io(pn).plists.find('nsecs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 if ~isEmptyDouble(io(pn).plists.find('fs')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 if ~isequal(io(pn).plists.find('t0'), '1970-01-01 00:00:00.000'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 if ~isEmptyChar(io(pn).plists.find('yunits')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624 if ~isequal(io(pn).plists.getOptionsForParam('nsecs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 if ~isequal(io(pn).plists.getOptionsForParam('fs'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 if ~isequal(io(pn).plists.getOptionsForParam('t0'), {'1970-01-01 00:00:00.000'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628 if ~isequal(io(pn).plists.getOptionsForParam('yunits'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629 %%%%%%%%%% SET 'From smodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630 pn = 21;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 [atest, msg] = checkParamNumber(io, pn, 7);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 if ~io(pn).plists.isparam('model'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 if ~io(pn).plists.isparam('xunits'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638 if ~io(pn).plists.isparam('x'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 if ~io(pn).plists.isparam('type'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 if ~eq(io(pn).plists.find('model'), smodel(), ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642 if ~isequal(io(pn).plists.find('xunits'), 's'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 if ~isEmptyDouble(io(pn).plists.find('x')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644 if ~isequal(io(pn).plists.find('type'), 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646 if ~isequal(io(pn).plists.getOptionsForParam('xunits'), {'s'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 if ~isequal(io(pn).plists.getOptionsForParam('x'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 if ~isequal(io(pn).plists.getOptionsForParam('type'), {'tsdata', 'fsdata', 'xydata', 'cdata'}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 %%%%%%%%%% SET 'From pest'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 pn = 22;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 [atest, msg] = checkParamNumber(io, pn, 5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 if ~io(pn).plists.isparam('pest'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658 if ~io(pn).plists.isparam('parameter'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 if ~eq(io(pn).plists.find('pest'), []), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 if ~isequal(io(pn).plists.find('parameter'), ''), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663 if ~isequal(io(pn).plists.getOptionsForParam('pest'), {[]}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 if ~isequal(io(pn).plists.getOptionsForParam('parameter'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665 %%%%%%%%%% SET 'From Parameter'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 pn = 23;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 [atest, msg] = checkParamNumber(io, pn, 5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 % Check key
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 if ~io(pn).plists.isparam('name'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 if ~io(pn).plists.isparam('plotinfo'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 if ~io(pn).plists.isparam('description'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672 if ~io(pn).plists.isparam('parameter'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 if ~io(pn).plists.isparam('key'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674 % Check default value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 if ~isEmptyChar(io(pn).plists.find('parameter')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 if ~isEmptyChar(io(pn).plists.find('key')), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 % Check options
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 if ~isequal(io(pn).plists.getOptionsForParam('parameter'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679 if ~isequal(io(pn).plists.getOptionsForParam('key'), {''}), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 result = utp_prepare_result(atest, stest, dbstack, mfilename, msg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688 end % END UTP_01
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690 % check parameter number
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 function [atest, msg] = checkParamNumber(sets, setNum, paramNum)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 msg = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 if sets(setNum).plists.nparams ~= paramNum
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 msg = sprintf('Set %d plist does not have %d parameters', setNum, paramNum);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 %% UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 % Tests that the ao method properly applies history to the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 % ASCII-file constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708 function result = utp_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 fs = 5;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 Nsecs = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720 t = linspace(0, Nsecs-1/fs, Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 x = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722 out = [t;x].';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 %---- Save data as ascii file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725 name = 'data';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 filename1 = sprintf('%s.txt', name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727 save(filename1, 'out', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 filename2 = sprintf('%s.dat', name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729 save(filename2, 'out', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731 out1 = ao(filename1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 out2 = ao(filename2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 mout1 = rebuild(out1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 mout2 = rebuild(out2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 % 2) Check that the rebuilt objects are the same as 'out1' and 'ouit2'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 % Check that the data-object is a cdata-object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 if ~isa(out1.data, 'cdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 if ~isa(out2.data, 'cdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759 % Check that output contains the right values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 if ~isequal(out1.data.getY, out), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 if ~isequal(out2.data.getY, out), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763 if ~eq(mout1, out1, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 if ~eq(mout2, out2, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 % delete test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 delete(filename1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768 delete(filename2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
771 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
772
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
773 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
774 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
775 end % END UTP_08
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
776
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
777
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
778 %% UTP_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
779
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
780 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
781 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
782 % Tests that the ao method properly applies history to the complex
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
783 % ASCII-file constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
784 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
785 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
786 function result = utp_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
787
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
788 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
789 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
790 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
791 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
792 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
793
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
794 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
795 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
796 a1 = ao(1:123, randn(123,1)+randn(123,1)*1i, plist('type', 'fsdata'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
797 filename1 = 'complex1.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
798 filename2 = 'complex2.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
799 filename3 = 'complex3.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
800 filename4 = 'complex4.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
801 filename5 = 'complex5.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
802
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
803 %---- Save: f, real, imag
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
804 export1 = [a1.x real(a1.y) imag(a1.y)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
805 save(filename1, 'export1', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
806 %---- Save: f, abs, deg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
807 export2 = [a1.x abs(a1.y) (180/pi) * (angle(a1.y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
808 save(filename2, 'export2', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
809 %---- Save: f, abs, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
810 export3 = [a1.x abs(a1.y) angle(a1.y)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
811 save(filename3, 'export3', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
812 %---- Save: f, dB, deg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
813 export4 = [a1.x 20.*log10(abs(a1.y)) (180/pi) * (angle(a1.y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
814 save(filename4, 'export4', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
815 %---- Save: f, dB, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
816 export5 = [a1.x angle(a1.y) 20.*log10(abs(a1.y)) angle(a1.y) 20.*log10(abs(a1.y)) angle(a1.y) 20.*log10(abs(a1.y))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
817 save(filename5, 'export5', '-ASCII', '-DOUBLE', '-TABS');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
818
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
819 out1 = ao(filename1, plist('complex_type', 'real/imag'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
820 out2 = ao(filename2, plist('complex_type', 'abs/deg'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
821 out3 = ao(filename3, plist('complex_type', 'abs/rad'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
822 out4 = ao(filename4, plist('complex_type', 'dB/deg'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
823 out5 = ao(filename5, plist('complex_type', 'dB/rad', 'columns', [1 7 4]));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
824
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
825 mout1 = rebuild(out1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
826 mout2 = rebuild(out2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
827 mout3 = rebuild(out3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
828 mout4 = rebuild(out4);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
829 mout5 = rebuild(out5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
830 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
831 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
832 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
833 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
834 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
835 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
836
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
837 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
838 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
839 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
840 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
841 % 2) Check that the read data are correct
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
842 % 3) Check that the rebuilt object is the same as in 'out1..5'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
843 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
844 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
845
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
846 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
847 TOL = 1e-14;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
848 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
849 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
850 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
851 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
852 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
853 if ~strcmp(out3.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
854 if ~strcmp(out4.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
855 if ~strcmp(out5.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
856 % Check that output contains the correct values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
857 % 'out1' -> f, real, imag
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
858 if ~isequal(out1.x, a1.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
859 if any(abs(out1.y - a1.y) > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
860 % 'out2' -> f, abs, deg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
861 if ~isequal(out2.x, a1.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
862 if any(abs(out2.y - a1.y) > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
863 % 'out3' -> f, abs, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
864 if ~isequal(out3.x, a1.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
865 if any(abs(out3.y - a1.y) > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
866 % 'out4' -> f, dB, deg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
867 if ~isequal(out4.x, a1.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
868 if any(abs(out4.y - a1.y) > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
869 % 'out5' -> f, dB, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
870 if ~isequal(out5.x, a1.x), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
871 if any(abs(out5.y - a1.y) > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
872 % Check the re-built objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
873 if ~eq(mout1, out1, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
874 if ~eq(mout2, out2, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
875 if ~eq(mout3, out3, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
876 if ~eq(mout4, out4, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
877 if ~eq(mout5, out5, ple2), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
878 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
879 % delete test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
880 delete(filename1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
881 delete(filename2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
882 delete(filename3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
883 delete(filename4);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
884 delete(filename5);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
885 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
886 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
887 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
888
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
889 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
890 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
891 end % END UTP_09
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
892
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
893 %% UTP_13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
894
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
895 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
896 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
897 % Tests that the ao method properly applies history to the vals constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
898 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
899 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
900 function result = utp_13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
901
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
902 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
903 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
904 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
905 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
906 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
907
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
908 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
909 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
910 vals = [1 2 3 4 5; 1 2 3 4 5];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
911 out = ao(vals);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
912 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
913 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
914 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
915 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
916 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
917 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
918 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
919
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
920 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
921 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
922 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
923 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
924 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
925 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
926 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
927
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
928 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
929 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
930 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
931 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
932 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
933 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
934 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
935 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
936 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
937 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
938 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
939
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
940 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
941 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
942 end % END UTP_13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
943
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
944 %% UTP_15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
945
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
946 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
947 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
948 % Tests that the ao method properly applies history to the plist(fcn) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
949 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
950 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
951 function result = utp_15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
952
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
953 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
954 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
955 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
956 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
957 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
958
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
959 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
960 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
961 fcn = 'complex(randn(100,1), randn(100,1))';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
962 out = ao(plist('fcn', fcn));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
963 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
964 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
965 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
966 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
967 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
968 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
969 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
970
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
971 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
972 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
973 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
974 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
975 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
976 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
977 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
978
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
979 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
980 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
981 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
982 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
983 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
984 % Check values of the AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
985 if isreal(out.data.getY), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
986 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
987 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
988 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
989 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
990 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
991 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
992
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
993 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
994 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
995 end % END UTP_15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
996
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
997
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
998 %% UTP_16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
999
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1000 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1001 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1002 % Tests that the ao method properly applies history to the plist(vals) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1003 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1004 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1005 function result = utp_16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1006
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1007 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1008 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1009 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1010 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1011 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1012
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1013 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1014 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1015 vals = [1 2 3 4 5; 6 7 8 9 0];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1016 out = ao(plist('vals', vals));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1017 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1018 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1019 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1020 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1021 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1022 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1023 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1024
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1025 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1026 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1027 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1028 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1029 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1030 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1031 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1032
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1033 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1034 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1035 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1036 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1037 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1038 % Check values of the AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1039 if ~eq(out.data.getY, vals), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1040 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1041 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1042 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1043 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1044 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1045 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1046
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1047 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1048 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1049 end % END UTP_16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1050
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1051
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1052 %% UTP_17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1053
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1054 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1055 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1056 % Tests that the ao method properly applies history to the plist(x/y-vals) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1057 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1058 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1059 function result = utp_17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1060
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1061 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1062 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1063 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1064 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1065 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1066
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1067 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1068 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1069 xvals = 0:99;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1070 yvals = randn(100,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1071 out = ao(plist('xvals', xvals, 'yvals', yvals));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1072 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1073 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1074 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1075 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1076 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1077 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1078 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1079
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1080 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1081 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1082 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1083 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1084 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1085 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1086 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1087
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1088 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1089 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1090 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1091 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1092 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1093 % Check values of the AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1094 if ~eq(out.data.getX, xvals'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1095 if ~eq(out.data.getY, yvals), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1096 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1097 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1098 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1099 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1100 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1101 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1102
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1103 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1104 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1105 end % END UTP_17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1108 %% UTP_18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1109
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1110 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1111 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1112 % Tests that the ao method properly applies history to the plist(tsfcn) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1113 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1114 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1115 function result = utp_18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1116
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1117 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1118 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1119 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1120 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1121 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1122
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1123 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1124 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1125 tsfcn = 'sin(2*pi*7.433*t) + randn(size(t))';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1126 out = ao(plist('tsfcn', tsfcn, 'nsecs', 10, 'fs', 12.3));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1127 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1128 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1129 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1130 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1131 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1132 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1133 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1135 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1136 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1137 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1138 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1139 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1140 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1141 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1142
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1143 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1144 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1145 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1146 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1147 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1148 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1149 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1150 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1151 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1152 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1153 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1154
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1155 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1156 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1157 end % END UTP_18
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1158
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1159
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1160 %% UTP_19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1161
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1162 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1163 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1164 % Tests that the ao method properly applies history to the plist(fsfcn) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1165 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1166 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1167 function result = utp_19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1168
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1169 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1170 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1171 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1172 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1173 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1174
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1175 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1176 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1177 fsfcn1 = '1e-15.*(1e-3./f.^2 + 1e-10./f.^4)';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1178 fsfcn2 = '1./f.^2';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1179 out1 = ao(plist('fsfcn', fsfcn1, 'nf', 100));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1180 out2 = ao(plist('fsfcn', fsfcn2, 'nf', 100, 'scale', 'lin'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1181 mout1 = rebuild(out1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1182 mout2 = rebuild(out2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1183 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1184 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1185 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1186 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1187 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1188 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1189
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1190 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1191 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1192 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1193 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1194 % 2) Check that the rebuilt objects are the same as 'out1' and 'out2'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1195 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1196 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1197
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1198 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1199 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1200 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1201 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1202 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1203 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1204 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1205 if ~eq(mout1, out1, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1206 if ~eq(mout2, out2, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1207 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1208 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1209 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1210 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1212 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1213 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1214 end % END UTP_19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1215
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1217 %% UTP_20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1218
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1219 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1220 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1221 % Tests that the ao method properly applies history to the plist(win) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1222 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1223 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1224 function result = utp_20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1225
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1226 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1227 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1228 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1229 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1230 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1231
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1232 msg = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1233 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1234 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1235 win = specwin('Hamming', 10);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1236 out1 = ao(plist('win', win));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1237 mout1 = rebuild(out1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1238 out2 = ao(plist('win', 'Kaiser', 'length', 53, 'psll', 75));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1239 mout2 = rebuild(out2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1240 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1241 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1242 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1243 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1244 msg = err.message;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1245 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1246 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1247
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1248 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1249 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1250 % 1) Check that the last entry in the history of 'out' corresponds to 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1251 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1252 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1253 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1254
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1255 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1256 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1257 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1258 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1259 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; msg = 'last history step is not an ao constructor'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1260 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; msg = 'last history step is not an ao constructor'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1261 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1262 if ~isequal(win.win.', out1.data.getY), atest = false; msg = 'Window values are different when rebuilt'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1263 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1264 if ~eq(mout1, out1, ple1), atest = false; msg = '1st rebuilt object is different'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1265 if ~eq(mout2, out2, ple1), atest = false; msg = '2nd rebuilt object is different'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1266 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1267 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1268 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1269 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1270
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1271 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1272 result = utp_prepare_result(atest, stest, dbstack, mfilename, msg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1273 end % END UTP_20
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1274
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1275
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1276 %% UTP_21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1277
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1278 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1279 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1280 % Tests that the ao method properly applies history to the plist(waveform) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1281 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1282 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1283 function result = utp_21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1284
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1285 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1286 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1287 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1288 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1289 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1290
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1291 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1292 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1293 nsecs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1294 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1295 % Sine wave
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1296 pl_sin = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'sine wave' , 'phi', 30, 'f', 1.23);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1297 % Noise normal
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1298 pl_noise_norm = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'noise' , 'type', 'Normal');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1299 % Noise uniform
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1300 pl_noise_uni = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'noise' , 'type', 'Uniform');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1301 % Chirp
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1302 pl_chirp = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'chirp' , 'f0', 1, 'f1', 50, 't1', 100);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1303 % Gaussian pulse
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1304 pl_gauss = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Gaussian pulse' , 'f0', 10, 'bw', 100);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1305 % Square wave
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1306 pl_square = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Square wave' , 'f', 1, 'duty', 50);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1307 % Sawtooth
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1308 pl_saw = plist('nsecs', nsecs, 'fs', fs, 'waveform', 'Sawtooth' , 'width', 0.5, 'f', 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1309 out_sin = ao(pl_sin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1310 out_nn = ao(pl_noise_norm);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1311 out_nu = ao(pl_noise_uni);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1312 out_chirp = ao(pl_chirp);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1313 out_gauss = ao(pl_gauss);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1314 out_square = ao(pl_square);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1315 out_saw = ao(pl_saw);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1316
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1317 mout_sin = rebuild(out_sin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1318 mout_nn = rebuild(out_nn);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1319 mout_nu = rebuild(out_nu);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1320 mout_chirp = rebuild(out_chirp);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1321 mout_gauss = rebuild(out_gauss);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1322 mout_square = rebuild(out_square);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1323 mout_saw = rebuild(out_saw);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1324 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1325 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1326 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1327 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1328 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1329 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1330
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1331 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1332 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1333 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1334 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1335 % 2) Check that the rebuilt objects are the same as 'out_...'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1336 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1337 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1338
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1339 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1340 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1341 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1342 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1343 if ~strcmp(out_sin.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1344 if ~strcmp(out_nn.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1345 if ~strcmp(out_nu.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1346 if ~strcmp(out_chirp.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1347 if ~strcmp(out_gauss.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1348 if ~strcmp(out_square.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1349 if ~strcmp(out_saw.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1350 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1351 if ~eq(mout_sin, out_sin, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1352 if ~eq(mout_nn, out_nn, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1353 if ~eq(mout_nu, out_nu, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1354 if ~eq(mout_chirp, out_chirp, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1355 if ~eq(mout_gauss, out_gauss, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1356 if ~eq(mout_square, out_square, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1357 if ~eq(mout_saw, out_saw, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1358 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1359 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1360 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1361 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1362
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1363 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1364 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1365 end % END UTP_21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1366
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1367
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1368
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1369 %% UTP_23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1370
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1371 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1372 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1373 % Tests that the ao method properly applies history to the plist(polynomial) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1374 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1375 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1376 function result = utp_23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1377
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1378 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1379 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1380 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1381 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1382 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1383
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1384 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1385 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1386 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1387 Nsecs = 20;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1388 coeffs = ao([2 0 1]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1389 out1 = ao(plist('polyval', coeffs, 'fs', fs, 'Nsecs', Nsecs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1390 out2 = ao(plist('polyval', coeffs.y, 'fs', fs, 'Nsecs', Nsecs));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1391 mout1 = rebuild(out1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1392 mout2 = rebuild(out2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1393 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1394 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1395 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1396 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1397 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1398 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1399
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1400 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1401 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1402 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1403 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1404 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1405 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1406 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1407
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1408 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1409 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1410 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1411 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1412 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1413 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1414 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1415 t = [0 : 1/fs : Nsecs-1/fs].';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1416 y = polyval(coeffs.y,t);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1417 if ~isequal(out1.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1418 if ~isequal(out2.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1419 if ~isequal(out1.data.getX, t), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1420 if ~isequal(out2.data.getX, t), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1421 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1422 if ~eq(mout1, out1, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1423 if ~eq(mout2, out2, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1424 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1425 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1426 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1427 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1428
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1429 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1430 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1431 end % END UTP_23
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1432
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1433
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1434 %% UTP_25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1435
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1436 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1437 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1438 % Tests that the ao method properly applies history to the plist(specwin) constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1439 % Tests that the ao method properly uses the specwin values.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1440 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1441 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1442 function result = utp_25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1443
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1444 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1445 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1446 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1447 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1448 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1449
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1450 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1451 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1452 msg = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1453
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1454 % Test Kaiser window
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1455 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1456 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1457 win = specwin('kaiser', randi(1000, 1), 10);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1458 out = ao(win);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1459 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1460 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1461 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1462 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1463 msg = err.message;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1464 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1465 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1466
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1467 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1468 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1469 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1470 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1471 % 2) Check that the object contains the same data as the window.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1472 % 3) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1473 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1474 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1475
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1476 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1477 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1478 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1479 if ~strcmp(out.hist.methodInfo.mname, 'ao'), msg = 'last history step is not the ao constructor'; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1480 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1481 if ~isequal(win.win', out.data.getY), msg = 'window values are different in the resulting ao'; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1482 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1483 if ~eq(mout, out, ple1), msg = ['the rebuilt object is not the same as the original: ' lastwarn]; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1484 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1485 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1486 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1487 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1488
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1489 win_list = specwin.getTypes;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1490
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1491 % Test standard windows
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1492 for kk = 1:numel(win_list)-2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1493 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1494 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1495 win = specwin(win_list{kk}, randi(1000, 1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1496 out = ao(win);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1497 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1498 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1499
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1500 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1501 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1502 msg = err.message;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1503 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1504 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1505
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1506 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1507 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1508 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1509 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1510 % 2) Check that the object contains the same data as the window.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1511 % 3) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1512 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1513 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1514
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1515 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1516 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1517 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1518 if ~strcmp(out.hist.methodInfo.mname, 'ao'), msg = 'last history step is not the ao constructor'; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1519 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1520 if ~isequal(win.win', out.data.getY), msg = 'window values are different in the resulting ao'; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1521 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1522 if ~eq(mout, out, ple1), msg = ['the rebuilt object is not the same as the original: ' lastwarn]; atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1523 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1524 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1525 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1526 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1527
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1528 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1529
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1530 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1531 result = utp_prepare_result(atest, stest, dbstack, mfilename, msg);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1532 end % END UTP_25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1533
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1534
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1535 %% UTP_26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1536
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1537 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1538 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1539 % Tests that the ao method properly applies history to the data-object constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1540 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1541 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1542 function result = utp_26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1543
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1544 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1545 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1546 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1547 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1548 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1549
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1550 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1551 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1552 y = randn(100,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1553 m = randn(3,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1554
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1555 out1 = ao(cdata(m));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1556 out2 = ao(fsdata(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1557 out3 = ao(tsdata(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1558 out4 = ao(xydata(y));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1559 out5 = ao(xyzdata);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1560 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1561 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1562 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1563 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1564 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1565 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1566
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1567 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1568 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1569 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1570 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1571 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1572 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1573
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1574 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1575 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1576 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1577 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1578 if ~strcmp(out1.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1579 if ~strcmp(out2.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1580 if ~strcmp(out3.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1581 if ~strcmp(out4.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1582 if ~strcmp(out5.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1583 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1584 if ~isa(out1.data, 'cdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1585 if ~isa(out2.data, 'fsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1586 if ~isa(out3.data, 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1587 if ~isa(out4.data, 'xydata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1588 if ~isa(out5.data, 'xyzdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1589 if ~eq(out1.data.getY, m), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1590 if ~eq(out2.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1591 if ~eq(out3.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1592 if ~eq(out4.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1593 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1594 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1595 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1596 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1597
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1598 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1599 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1600 end % END UTP_26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1601
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1602 %% UTP_28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1603
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1604 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1605 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1606 % Tests that the ao method properly applies history to the x-vector, y-vector constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1607 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1608 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1609 function result = utp_28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1610
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1611 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1612 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1613 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1614 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1615 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1616
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1617 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1618 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1619 x = 0:99;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1620 y = randn(100,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1621
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1622 out = ao(x, y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1623 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1624 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1625 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1626 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1627 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1628 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1629 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1630
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1631 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1632 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1633 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1634 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1635 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1636 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1637 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1638
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1639 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1640 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1641 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1642 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1643 if ~strcmp(out.hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1644 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1645 if ~eq(out.data.getX, x'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1646 if ~eq(out.data.getY, y), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1647 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1648 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1649 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1650 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1651 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1652 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1653
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1654 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1655 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1656 end % END UTP_28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1657
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1658
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1659 %% UTP_29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1660
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1661 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1662 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1663 % Tests that the ao method properly applies history to the filename +
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1664 % plist constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1665 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1666 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1667 function result = utp_29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1668
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1669 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1670 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1671 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1672 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1673 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1674
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1675 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1676 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1677 %---- Make test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1678 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1679 Nsecs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1680 t = linspace(0, Nsecs-1/fs, Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1681 x1 = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1682 x2 = randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1683
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1684 %---- Save data as ascii file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1685 filename = 'data.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1686 fd = fopen(filename, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1687 % write header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1688 fprintf(fd, '// A comment that should be read appropriately.\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1689 fprintf(fd, '// \n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1690 fprintf(fd, '// M Hewitson\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1691 % write data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1692 for j=1:length(t)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1693 fprintf(fd, '%.17g\t%.17g\t%.17g\n', t(j), x1(j), x2(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1694 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1695 % close file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1696 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1697
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1698 desc = 'ao from filename';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1699 xunits = 's';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1700 yunits = 'V';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1701
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1702 pl = plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1703 'description', desc,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1704 'type', 'tsdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1705 'xunits', xunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1706 'yunits', yunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1707 'columns', [1 2 1 3], ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1708 'comment_char', '//');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1709
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1710 out = ao(filename, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1711 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1712 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1713 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1714 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1715 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1716 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1717 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1718
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1719 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1720 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1721 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1722 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1723 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1724 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1725 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1726
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1727 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1728 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1729 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1730 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1731 if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1732 if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1733 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1734 if ~isa(out(1).data, 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1735 if ~isa(out(2).data, 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1736 if any(abs(out(1).data.getX - t.') > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1737 if ~isequal(out(1).data.getY, x1.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1738 if any(abs(out(2).data.getX - t.') > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1739 if ~isequal(out(2).data.getY, x2.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1740 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1741 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1742 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1743 delete(filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1744 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1745 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1746 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1747
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1748 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1749 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1750 end % END UTP_29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1751
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1752
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1753 %% UTP_30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1754
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1755 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1756 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1757 % Tests that the ao method properly applies history to the filename +
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1758 % plist constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1759 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1760 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1761 function result = utp_30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1762
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1763 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1764 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1765 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1766 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1767 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1768
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1769 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1770 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1771 %---- Make test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1772 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1773 Nsecs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1774 t = linspace(0, Nsecs-1/fs, Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1775 x1 = .1*randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t) + randn(1,Nsecs*fs)*1i;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1776 x2 = .1*randn(1,Nsecs*fs) + 2*sin(2*pi*45.*t) + randn(1,Nsecs*fs)*1i;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1777
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1778 %---- Save data as ascii file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1779 filename = 'complex.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1780 fd = fopen(filename, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1781 % write header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1782 fprintf(fd, '// A comment that should be read appropriately.\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1783 fprintf(fd, '// \n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1784 fprintf(fd, '// M Hewitson\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1785 % write data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1786 for j=1:length(t)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1787
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1788 %---- Save: f, abs, rad, abs, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1789 fprintf(fd, '%.17g\t%.17g\t%.17g\t%.17g\t%.17g\n', t(j), abs(x1(j)), angle(x1(j)), abs(x2(j)), angle(x2(j)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1790 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1791 % close file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1792 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1793
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1794 desc = 'ao from complex data';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1795 xunits = 'Hz';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1796 yunits = 'V';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1797
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1798 pl = plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1799 'complex_type', 'abs/rad', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1800 'columns', [1 2 3 1 4 5], ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1801 'type', 'xydata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1802 'description', desc,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1803 'xunits', xunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1804 'yunits', yunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1805 'comment_char', '//');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1806
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1807 out = ao(filename, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1808 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1809 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1810 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1811 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1812 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1813 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1814 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1815
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1816 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1817 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1818 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1819 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1820 % 2) Check the read data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1821 % 3) Check that the rebuilt object is the same as 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1822 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1823 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1824
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1825 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1826 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1827 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1828 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1829 if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1830 if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1831 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1832 if ~isa(out(1).data, 'xydata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1833 if ~isa(out(2).data, 'xydata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1834 % 'out(1)' -> f, abs, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1835 if ~isequal(out(1).x, t.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1836 if any(abs(out(1).y - x1.') > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1837 if ~eq(out(1).yunits, unit(yunits)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1838 if ~eq(out(1).xunits, unit(xunits)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1839 if ~strcmp(out(1).description, desc), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1840 % 'out(2)' -> f, abs, rad
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1841 if ~isequal(out(2).x, t.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1842 if any(abs(out(2).y - x2.') > TOL), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1843 if ~eq(out(2).yunits, unit(yunits)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1844 if ~eq(out(2).xunits, unit(xunits)), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1845 if ~strcmp(out(2).description, desc), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1846 % Check the re-built object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1847 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1848 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1849 % delete test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1850 delete(filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1851 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1852 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1853 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1854
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1855 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1856 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1857 end % END UTP_30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1858
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1859
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1860 %% UTP_31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1861
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1862 % <TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1863 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1864 % Tests that the ao method properly applies history to the filename + plist constructor.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1865 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1866 % </TestDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1867 function result = utp_31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1868
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1869 % <SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1870 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1871 % Test that the output can be processed back to an m-file.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1872 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1873 % </SyntaxDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1874
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1875 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1876 % <SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1877 fs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1878 Nsecs = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1879 t0 = time('2008-02-15 14:00:00');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1880 col = [2 3];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1881 x1 = randn(1,Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1882 x2 = randn(1,Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1883 x3 = randn(1,Nsecs*fs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1884
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1885 %---- Save data as ascii file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1886 filename = 'data.txt';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1887 fd = fopen(filename, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1888 % write header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1889 fprintf(fd, '%% A comment that should be read appropriately.\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1890 fprintf(fd, '%% \n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1891 fprintf(fd, '%% M Hewitson\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1892 % write data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1893 for j=1:length(x1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1894 fprintf(fd, '%.17g\t%.17g\t%.17g\n', x1(j), x2(j), x3(j));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1895 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1896 % close file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1897 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1898
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1899 % Build plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1900 desc = 'ao from filename';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1901 xunits = 's';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1902 yunits = {'V', 'V^2'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1903
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1904 pl = plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1905 'description', desc,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1906 'type', 'tsdata', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1907 'xunits', xunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1908 'yunits', yunits, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1909 'columns', col, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1910 'fs', fs, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1911 't0', {t0, t0+20}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1912 'comment_char', '%');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1913
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1914 out = ao(filename, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1915 mout = rebuild(out);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1916 % </SyntaxCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1917 stest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1918 catch err
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1919 disp(err.message)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1920 stest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1921 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1922
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1923 % <AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1924 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1925 % 1) Check that the last entry in the history of 'out' corresponds to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1926 % 'ao'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1927 % 2) Check that the rebuilt object is the same as 'out'.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1928 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1929 % </AlgoDescription>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1930
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1931 atest = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1932 if stest
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1933 % <AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1934 % Check the last step in the history of 'out'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1935 if ~strcmp(out(1).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1936 if ~strcmp(out(2).hist.methodInfo.mname, 'ao'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1937 % Check data values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1938 if ~isa(out(1).data, 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1939 if ~isa(out(2).data, 'tsdata'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1940 if ~isequal(out(1).data.getY, x2.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1941 if ~isequal(out(2).data.getY, x3.'), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1942 if ~eq(unit(xunits), out(1).data.xunits), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1943 if ~eq(unit(yunits{1}), out(1).data.yunits), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1944 if ~eq(unit(xunits), out(2).data.xunits), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1945 if ~eq(unit(yunits{2}), out(2).data.yunits), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1946 if ~eq(out(1).data.t0, t0, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1947 if ~eq(out(2).data.t0, t0 + 20, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1948 if ~out(1).data.fs == fs, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1949 if ~out(2).data.fs == fs, atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1950 % Check the rebuilt object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1951 if ~eq(mout, out, ple1), atest = false; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1952 % </AlgoCode>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1953 % delete test file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1954 delete(filename)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1955 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1956 atest = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1957 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1958
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1959 % Return a result structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1960 result = utp_prepare_result(atest, stest, dbstack, mfilename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1961 end % END UTP_31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1962
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1963
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1964 end
|