comparison m-toolbox/classes/@plist/plist.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children 947e2ff4b1b9
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % PLIST Plist class object constructor.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: PLIST Parameter-List Object class object constructor.
5 % Create a plist object.
6 %
7 % SUPER CLASSES: ltpda_uo < ltpda_obj
8 %
9 % CONSTRUCTORS:
10 %
11 % pl = plist() - create an empty plist object.
12 % pl = plist(p) - create a plist with elements p
13 % where p is an array of param objects.
14 % pl = plist('key', val) - create a plist with the key/value
15 % pair
16 % pl = plsit({'key', 'desc'}, val) - create a plist with the key/value
17 % pair and a description for the 'key'
18 % pl = plist('key1', val1, ... - create a plist with more key/value
19 % 'key2', val2, ... pairs
20 % {'key3', 'desc'}, 'val3)
21 % pl = plist({'a', 1, 'b', 2}) - create a plist from a cell
22 % pl = plist('file.xml') - load a plist-object from xml-file
23 % pl = plist('file.mat') - load a plist-object from mat-file
24 % pl = plist(pl) - copies the input plist.
25 %
26 % PARAMETERS:
27 %
28 % If no recognised parameters are found in the input plist, the input
29 % plist is simply returned. This is the copy constructor.
30 %
31 % <a href="matlab:utils.helper.displayMethodInfo('plist', 'plist')">Parameters Description</a>
32 %
33 % VERSION: $Id: plist.m,v 1.146 2011/08/15 05:58:04 hewitson Exp $
34 %
35 % SEE ALSO: ltpda_obj, ltpda_uo, ltpda_uoh, param
36 %
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38
39 classdef plist < ltpda_uo
40
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 % Property definition %
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
45 %---------- Public (read/write) Properties ----------
46 properties
47 end
48
49 %---------- Protected read-only Properties ----------
50 properties (SetAccess = protected)
51 params = []; % list of param-objects
52 end
53
54 %---------- Removed properties ----------
55 % We have to define the removed properties as hidden constants.
56 % In case of backwards compatibility it is necessary to keep them because
57 % MATLAB will read older MAT-files as structures which we have to convert
58 % into an object if we make major change to a class.
59 % For MATLAB is a major change if we remove a proeprty.
60 properties (Constant = true, Hidden = true)
61 creator = [];
62 created = [];
63 end
64
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 % Check property setting %
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68
69
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 % Constructor %
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73
74 methods
75 function pl = plist(varargin)
76
77 import utils.const.*
78
79 %%%%%%%%%% Set dafault values %%%%%%%%%%
80
81 %%%%%%%%%% Overwrite dafault name %%%%%%%%%%
82 pl.name = '';
83
84 %%%%%%%%%% Copy constructor %%%%%%%%%%
85 % Collect all plist objects
86 [pls, invars, rest] = utils.helper.collect_objects(varargin(:), 'plist');
87
88 if isempty(rest) && ~isempty(pls) && numel(pls) ~=1
89 % Do copy constructor and return
90 utils.helper.msg(msg.OPROC1, 'copy constructor');
91 pl = copy(pls, 1);
92 return
93 end
94
95 if nargin == 0
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% no input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 %%%%%%%%%% pl = plist() %%%%%%%%%%
100
101 elseif nargin == 1
102
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106
107 if isa(varargin{1}, 'plist') && numel(varargin{1}) == 1
108 %%%%%%%%%% p = param(plist) %%%%%%%%%%
109
110 pli = varargin{1};
111
112 if isempty(varargin{1}.params)
113 %%% If the plist is empty then return an empty plist object
114
115 else
116 %%% Retrieve from repository?
117 if pli.isparam('hostname') || pli.isparam('conn')
118 utils.helper.msg(msg.OPROC1, 'retrieving from repository %s', pli.find('hostname'));
119 pl = pl.fromRepository(pli);
120 elseif pli.isparam('filename')
121 utils.helper.msg(msg.OPROC1, 'constructing from filename');
122 pl = pl.fromFile(pli);
123 elseif pli.isparam('built-in')
124 utils.helper.msg(msg.OPROC1, 'constructing from model');
125 pl = pl.fromModel(pli);
126 else
127 utils.helper.msg(msg.OPROC1, 'copying from %s', varargin{1}.name);
128 pl = copy(varargin{1}, 1);
129 end
130 end
131
132 elseif ischar(varargin{1})
133 %%%%%%%%%%% From file %%%%%%%%%%%%%%%%%%%%%%%%
134
135 filename = varargin{1};
136 utils.helper.msg(msg.OPROC1, 'constructing from file %s', filename);
137 pl = fromFile(pl, filename);
138
139 elseif isstruct(varargin{1})
140 %%%%%%%%%% pl = plist(struct) %%%%%%%%%%
141
142 utils.helper.msg(msg.OPROC1, 'constructing from struct');
143 pl = fromStruct(pl, varargin{1});
144
145 elseif isa(varargin{1}, 'param')
146 %%%%%%%%%% pl = plist(param) %%%%%%%%%%
147
148 utils.helper.msg(msg.OPROC1, 'constructing from param');
149 pl.params = varargin{1};
150
151 elseif iscell(varargin{1})
152 %%%%%%%%%% pl = plist({'a', 1, 'b', 2}) %%%%%%%%%%
153 c = varargin{1};
154 pl = plist(c{:});
155
156 else
157 error ('### unknown arguments to construct a parameter list')
158 end
159
160 elseif nargin == 2
161
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% two inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165
166 if (isa(varargin{1}, 'database') || isa(varargin{1}, 'mpipeline.repository.RepositoryConnection'))
167 %%%%%%%%%%% From DATABASE %%%%%%%%%%%
168 utils.helper.msg(msg.OPROC1, 'constructing from database object');
169 pl = pl.fromRepository(plist('conn', varargin{1}, 'id', varargin{2}));
170
171 elseif ischar(varargin{1})
172 %%%%%%%%%% pl = plist('key1', val1) %%%%%%%%%%
173 utils.helper.msg(msg.OPROC1, 'constructing from key/value pair');
174 pl.params = param(varargin{1}, varargin{2});
175
176 elseif iscell(varargin{1}) && numel(varargin{1}) == 2 && ~iscell(varargin{2})
177 %%%%%%%%%% pl = plist({'key', 'desc'}, val1) %%%%%%%%%%
178 utils.helper.msg(msg.OPROC1, 'constructing from [key,desc]/value pair');
179 pl.params = param(varargin{1}{1}, varargin{2}, varargin{1}{2});
180
181 elseif iscell(varargin{1}) && iscell(varargin{2})
182 %%%%%%%%%% pl = plist({'key', 'desc'}, {value, {options}, selection}) %%%%%%%%%%
183 pl.params = param(varargin{1}, varargin{2});
184
185 elseif isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ...
186 isa(varargin{2}, 'history')
187 %%%%%%%%%% obj = plist(DOM node, history-objects) %%%%%%%%%%
188 pl = fromDom(pl, varargin{1}, varargin{2});
189
190 else
191 error('### Unknown constructor method for two inputs.');
192 end
193
194 elseif nargin > 2
195
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% more inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
199
200 utils.helper.msg(msg.OPROC1, 'constructing from key/value pairs');
201
202 %%%%%%%%%% pl = plist('key1', val1, 'key2', val2 , ...) %%%%%%%%%%
203 %%%%%%%%%% pl = plist({'key1', 'desc'}, val1, 'key2', val2 , ...) %%%%%%%%%%
204 param_list = [];
205 argin = varargin;
206 while length(argin) >= 2
207 key = argin{1};
208 val = argin{2};
209 desc = '';
210 argin = argin(3:end);
211
212 % It might be that the key is specified with a description
213 if iscell(key) && numel(key) == 2
214 desc = key{2};
215 key = key{1};
216 end
217
218 if ~isempty(param_list)
219 found = any(strcmpi(key, {param_list(:).key}));
220 if found
221 error('### Do not use the same key [%s] twice.\n### REMARK: The key is not case sensitive.', key);
222 end
223 end
224 % add to list
225 if isempty(desc)
226 param_list = [param_list param(key, val)];
227 else
228 param_list = [param_list param(key, val, desc)];
229 end
230 end
231 pl.params = param_list;
232 else
233 error('### Unknown number of constructor arguments.');
234 end
235
236 end % End constructor
237 end
238
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240 % Methods (Static, Public) %
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242
243 methods (Static = true)
244
245 function out = VEROUT()
246 out = '$Id: plist.m,v 1.146 2011/08/15 05:58:04 hewitson Exp $';
247 end
248
249 function ii = getInfo(varargin)
250 ii = utils.helper.generic_getInfo(varargin{:}, 'plist');
251 end
252
253 function mdls = getBuiltInModels(varargin)
254 mdls = ltpda_uo.getBuiltInModels('plist');
255 end
256
257 function out = SETS()
258 out = SETS@ltpda_uo;
259 end
260
261 function plout = getDefaultPlist(set)
262 persistent pl;
263 persistent lastset;
264 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
265 pl = plist.buildplist(set);
266 lastset = set;
267 end
268 plout = pl;
269 end
270
271 varargout = getDefaultAxisPlist(varargin);
272
273 function out = buildplist(set)
274
275 if ~utils.helper.ismember(lower(plist.SETS), lower(set))
276 error('### Unknown set [%s]', set);
277 end
278
279 out = plist();
280 out = buildplist@ltpda_uo(out, set);
281
282 switch lower(set)
283 % No special sets are dfined.
284 end
285 end
286
287 %---------- static factory plists
288
289 % Plist to construct objects from a plist
290 function pl = FROM_PLIST
291 pl = plist();
292 p = param({'Plist','A plist'}, plist);
293 pl.append(p);
294 end
295
296 % Plist to construct an object from a built-in model
297 function pl = FROM_BUILT_IN
298 pl = plist();
299 p = param({'built-in', 'Choose one of the built-in models. (use <i>class</i>.getBuiltInModels to get a list for a particular user class)'}, paramValue.EMPTY_STRING);
300 pl.append(p);
301 end
302
303 % Plist to read from an XML file.
304 function pl = FROM_XML_FILE
305 pl = plist();
306 p = param({'filename','XML filename.'}, paramValue.EMPTY_STRING);
307 pl.append(p);
308 end
309
310 % Plist to read from an XML file.
311 function pl = FROM_MAT_FILE
312 pl = plist();
313 p = param({'filename','MAT filename.'}, paramValue.EMPTY_STRING);
314 pl.append(p);
315 end
316
317 % Plist for retrieving objects from a repository. This is used in all
318 % user-object constructor default plists for the 'From Repository' set.
319 function pl = FROM_REPOSITORY_PLIST
320 pl = plist();
321
322 % get repository list
323 prefs = getappdata(0, 'LTPDApreferences');
324 hostNames = prefs.getRepoPrefs.getHostnames;
325 repos = {};
326 for ii=0:hostNames.size()-1
327 repos = [repos {hostNames.get(ii)}];
328 end
329
330 % Hostname
331 if isempty(repos)
332 repos = {'localhost'};
333 end
334 p = param({'hostname','The repository hostname'}, {1, repos, paramValue.SINGLE});
335 pl.append(p);
336
337 % ID
338 p = param({'ID','A vector of object IDs.'}, paramValue.EMPTY_DOUBLE);
339 pl.append(p);
340
341 % CID
342 p = param({'CID','A vector of collection IDs.'}, paramValue.EMPTY_DOUBLE);
343 pl.append(p);
344
345 % Database
346 p = param({'database','The database name.'}, paramValue.EMPTY_STRING);
347 pl.append(p);
348
349 % Binary
350 p = param({'Binary','<html>Set to ''yes'' to retrieve from<br>stored binary representation (not always available).</html>'},...
351 paramValue.YES_NO);
352 pl.append(p);
353
354 % Username
355 p = param({'Username', 'Specify a username to connect with. Leave blank to be prompted.'}, paramValue.EMPTY_STRING);
356 pl.append(p);
357
358 % Password
359 p = param({'Password', 'Specify a password to connect with. Leave blank to be prompted.'}, paramValue.EMPTY_STRING);
360 pl.append(p);
361 end
362
363 % Plist for submitting/updating objects from a repository. This is used
364 % in ltpda_uo/ -submit, -bsubmit and -update.
365 function pl = TO_REPOSITORY_PLIST
366 pl = plist();
367
368 % get repository list
369 prefs = getappdata(0, 'LTPDApreferences');
370 hostNames = prefs.getRepoPrefs.getHostnames;
371 repos = {};
372 for ii=0:hostNames.size()-1
373 repos = [repos {hostNames.get(ii)}];
374 end
375
376 % Hostname
377 if isempty(repos)
378 repos = {'localhost'};
379 end
380 p = param({'hostname', 'Repository server hostname'}, {1, repos, paramValue.SINGLE});
381 pl.append(p);
382
383 % Database
384 p = param({'database', 'Database name'}, paramValue.EMPTY_STRING);
385 pl.append(p);
386
387 % Username
388 p = param({'username', 'User name to access the repository'}, paramValue.EMPTY_STRING);
389 pl.append(p);
390
391 % Password
392 p = param({'password', 'Password'}, paramValue.EMPTY_STRING);
393 pl.append(p);
394
395 % experiment title
396 p = param({'experiment title', 'Title for the submission'}, paramValue.EMPTY_STRING);
397 pl.append(p);
398
399 % experiment description
400 p = param({'experiment description', 'Description of this submission'}, paramValue.EMPTY_STRING);
401 pl.append(p);
402
403 % analysis description
404 p = param({'analysis description', 'Description of the analysis performed'}, paramValue.EMPTY_STRING);
405 pl.append(p);
406
407 % quantity
408 p = param({'quantity', 'Physical quantity represented by the data'}, paramValue.EMPTY_STRING);
409 pl.append(p);
410
411 % keywords
412 p = param({'keywords', 'Comma-delimited list of keywords'}, paramValue.EMPTY_STRING);
413 pl.append(p);
414
415 % reference ids
416 p = param({'reference ids', 'Comma-delimited list of object IDs'}, paramValue.EMPTY_STRING);
417 pl.append(p);
418
419 % additional comments
420 p = param({'additional comments', 'Additional comments'}, paramValue.EMPTY_STRING);
421 pl.append(p);
422
423 % additional authors
424 p = param({'additional authors', 'Additional author names'}, paramValue.EMPTY_STRING);
425 pl.append(p);
426
427 p = param({'no dialog', 'Do not use of the submission form. Mandatory fields must be supplied in the plist.'}, paramValue.FALSE_TRUE);
428 pl.append(p);
429
430 p = param({'use selector', 'Allow to select to which database to connect'}, paramValue.TRUE_FALSE);
431 pl.append(p);
432
433 end
434
435 % Plist for Welch-based, linearly spaced spectral estimators.
436 % This is used in psd, cpsd, cohere, tfe
437 function pl = WELCH_PLIST
438 pl = plist();
439
440 % Nfft
441 p = param({'Nfft',['The number of samples in each fft [default: length of input data]. <br>', ...
442 'A string value containing the variable ''fs'' can also be used, e.g., <br> ', ...
443 '<tt>plist(''Nfft'', ''2*fs'')</tt>']}, paramValue.DOUBLE_VALUE(-1));
444 pl.append(p);
445
446 % Win
447 p = param({'Win',['The window to be applied to the data to remove the ', ...
448 'discontinuities at edges of segments. [default: taken from user prefs] <br>', ...
449 'Only the design parameters of the window object are used. Enter ', ...
450 'a string value containing the window name e.g.<br>', ...
451 '<tt>plist(''Win'', ''Kaiser'', ''psll'', 200)</tt><br>', ...
452 '<tt>plist(''Win'', ''BH92'')</tt>']}, paramValue.WINDOW);
453 pl.append(p);
454
455 % Psll
456 p = param({'Psll',['The peak sidelobe level for Kaiser windows.<br>', ...
457 'Note: it is ignored for all other windows']}, paramValue.DOUBLE_VALUE(200));
458 pl.append(p);
459
460 % Olap
461 p = param({'Olap','The segment percent overlap [-1 == take from window function]'}, {1, {-1}, paramValue.OPTIONAL});
462 pl.append(p);
463
464 % Order
465 p = param({'Order',['The order of segment detrending:<ul>', ...
466 '<li>-1 - no detrending</li>', ...
467 '<li>0 - subtract mean</li>', ...
468 '<li>1 - subtract linear fit</li>', ...
469 '<li>N - subtract fit of polynomial, order N</li></ul>']}, paramValue.DETREND_ORDER);
470 p.val.setValIndex(2);
471 pl.append(p);
472
473 % Navs
474 p = param({'Navs',['Force number of averages. If set, and if Nfft was set to 0 or -1,<br>', ...
475 'the number of points for each window will be calculated to match the request.']}, paramValue.DOUBLE_VALUE(-1));
476 pl.append(p);
477
478 % Times
479 p = param({'Times',['The time range to analyze. If not empty, sets the time interval to operate on.<br>', ...
480 'As in ao/split, the interval can be specified by:<ul>' ...
481 '<li>a vector of doubles</li>' ...
482 '<li>a timespan object</li>' ...
483 '<li>a cell array of time strings</li>' ...
484 '<li>a vector of time objects</li></ul>' ...
485 ]}, paramValue.DOUBLE_VALUE([]));
486 pl.append(p);
487
488 % Split: the same as 'times'
489 p = p.copy(true);
490 pl.append(p.setKey('Split'));
491
492 end
493
494 % Plist for Welch-based, log-scale spaced spectral estimators.
495 % This is used in lpsd, lcpsd, lcohere, ltfe
496 function pl = LPSD_PLIST
497 pl = plist();
498
499 % Kdes
500 p = param({'Kdes', 'The desired number of averages.'}, {1, {100}, paramValue.OPTIONAL});
501 pl.append(p);
502
503 % Jdes
504 p = param({'Jdes', 'The desired number of spectral frequencies to compute.'}, {1, {1000}, paramValue.OPTIONAL});
505 pl.append(p);
506
507 % Lmin
508 p = param({'Lmin', 'The minimum segment length.'}, {1, {0}, paramValue.OPTIONAL});
509 pl.append(p);
510
511 % Win
512 p = param({'Win',['The window to be applied to the data to remove the ', ...
513 'discontinuities at edges of segments. [default: taken from user prefs] <br>', ...
514 'Only the design parameters of the window object are used. Enter ', ...
515 'a string value containing the window name e.g.<br>', ...
516 '<tt>plist(''Win'', ''Kaiser'', ''psll'', 200)</tt><br>', ...
517 '<tt>plist(''Win'', ''BH92'')</tt>']}, paramValue.WINDOW);
518 pl.append(p);
519
520 % Psll
521 p = param({'Psll',['The peak sidelobe level for Kaiser windows.<br>', ...
522 'Note: it is ignored for all other windows']}, paramValue.DOUBLE_VALUE(200));
523 pl.append(p);
524
525 % Olap
526 p = param({'Olap','The segment percent overlap [-1 == take from window function]'}, {1, {-1}, paramValue.OPTIONAL});
527 pl.append(p);
528
529 % Order
530 p = param({'Order',['The order of segment detrending:<ul>', ...
531 '<li>-1 - no detrending</li>', ...
532 '<li>0 - subtract mean</li>', ...
533 '<li>1 - subtract linear fit</li>', ...
534 '<li>N - subtract fit of polynomial, order N</li></ul>']}, paramValue.DETREND_ORDER);
535 p.val.setValIndex(2);
536 pl.append(p);
537
538 % Times
539 p = param({'Times',['The time range to analyze. If not empty, sets the time interval to operate on.<br>', ...
540 'As in ao/split, the interval can be specified by:<ul>' ...
541 '<li>a vector of doubles</li>' ...
542 '<li>a timespan object</li>' ...
543 '<li>a vector of time objects</li></ul>' ...
544 ]}, paramValue.DOUBLE_VALUE([]));
545 pl.append(p);
546
547 % Split: the same as 'times'
548 p = p.copy(true);
549 pl.append(p.setKey('Split'));
550
551 end
552
553 % Plist for linear fitting methods
554 % This is used in linfit, polynomfit
555
556 function pl = LINEAR_FIT_PLIST
557 pl = plist();
558
559 % dy
560 p = param({'dy', ['Uncertainty on Y. Can be expressed as<ul>' ...
561 '<li>an AO with single value or</li>' ...
562 '<li>an AO with a vector of the right lenght or</li>' ...
563 '<li>a double or</li>' ...
564 '<li>an array of double of the right lenght</li></ul>' ]}, ...
565 paramValue.EMPTY_DOUBLE);
566 pl.append(p);
567
568 % dx
569 p = param({'dx', ['Uncertainty on X(1..N). Can be expressed as<ul>' ...
570 '<li>an AO with single value or</li>' ...
571 '<li>an AO with a vector of the right lenght or</li>' ...
572 '<li>a double or</li>' ...
573 '<li>an array of double of the right lenght</li></ul>' ]}, ...
574 paramValue.EMPTY_DOUBLE);
575 pl.append(p);
576
577 % p0
578 p = param({'p0', ['Initial guess of the fit parameters. Can be expressed as:<ul>' ...
579 '<li>an AOs with a vector</li>' ...
580 '<li>an array of scalars or</li>' ...
581 '<li>a pest object</li></ul>']}, ...
582 paramValue.EMPTY_DOUBLE);
583 pl.append(p);
584
585 end
586
587 % Plist for multilinear fitting methods
588 % This is used in bilinfit
589
590 function pl = MULTILINEAR_FIT_PLIST
591 pl = plist();
592
593 % dy
594 p = param({'dy', ['Uncertainty on Y. Can be expressed as<ul>' ...
595 '<li>an AO with single value or</li>' ...
596 '<li>an AO with a vector of the right lenght or</li>' ...
597 '<li>a double or</li>' ...
598 '<li>an array of double of the right lenght</li></ul>' ]}, ...
599 paramValue.EMPTY_DOUBLE);
600 pl.append(p);
601
602 % dx
603 p = param({'dx', ['Uncertainty on X1 ... XN. Can be expressed as<ul>' ...
604 '<li>an array of N AOs with single value or</li>' ...
605 '<li>an array of N AOs with data vectors of the right lenght or</li>' ...
606 '<li>an array of N double</li></ul>' ]}, ...
607 paramValue.EMPTY_DOUBLE);
608 pl.append(p);
609
610 % p0
611 p = param({'p0', ['Initial guess of the fit parameters. Can be expressed as:<ul>' ...
612 '<li>an AOs with a vector</li>' ...
613 '<li>an array of scalars or</li>' ...
614 '<li>a pest object</li></ul>']}, ...
615 paramValue.EMPTY_DOUBLE);
616 pl.append(p);
617
618 end
619
620 % Plist for multichannel fitting methods
621 % This is used in linfitsvd, mcmc, and tdfit
622
623 function pl = MCH_FIT_PLIST
624 pl = plist();
625
626 % Model
627 p = param({'Model','System model. It have to be parametric. A matrix of smodel objects or a ssm object'}, paramValue.EMPTY_DOUBLE);
628 pl.append(p);
629
630 % Input Names
631 p = param({'InNames','A cell array containing cell arrays of the input ports names for each experiment. Used only with ssm models.'}, {});
632 pl.append(p);
633
634 % Output Names
635 p = param({'OutNames','A cell array containing cell arrays of the output ports names for each experiment. Used only with ssm models.'}, {});
636 pl.append(p);
637
638 % Fit Params
639 p = param({'FitParams','A cell array with the names of the fit parameters'}, {});
640 pl.append(p);
641
642 % Injected Signals
643 p = param({'Input','Collection of input signals'},paramValue.EMPTY_DOUBLE);
644 pl.append(p);
645
646 end
647
648 % Plist for time series
649 % This is used in ao constructor
650 function pl = TSDATA_PLIST
651 pl = plist();
652 % Fs
653 p = param({'fs', 'The sampling frequency of the signal. [for all]'}, paramValue.EMPTY_DOUBLE);
654 pl.append(p);
655
656 % Nsecs
657 p = param({'nsecs', 'The number of seconds of data. [for all]'}, paramValue.EMPTY_DOUBLE);
658 pl.append(p);
659
660 % Xunits
661 p = param({'xunits','Unit on X axis.'}, paramValue.STRING_VALUE('s'));
662 pl.append(p);
663
664 % T0
665 p = param({'T0', 'The UTC time of the first sample. [for all]'}, {1, {'1970-01-01 00:00:00.000'}, paramValue.OPTIONAL});
666 pl.append(p);
667
668 % toffset
669 p = param({'toffset', 'The offset between the first x sample and t0.'}, paramValue.DOUBLE_VALUE(0));
670 pl.append(p);
671 end
672
673 % Plist for dotview methods (ltpda_uoh, ssm)
674 function pl = DOTVIEW_PLIST
675 pl = plist();
676
677 % Filename
678 p = param({'filename','the file name for the graphic file'}, paramValue.EMPTY_STRING);
679 pl.append(p);
680
681 % View
682 p = param({'view','true or false to view or not'}, paramValue.TRUE_FALSE);
683 p.val.setValIndex(1);
684 pl.append(p);
685
686 end
687
688 % Plist for saving objects
689 function pl = SAVE_OBJ_PLIST
690 pl = plist();
691
692 % Filename
693 p = param({'filename',['Name of the file to save in.<br>', ...
694 'The format is determined based on the file extension:<ul>', ...
695 '<li>.xml for XML format</li>', ...'
696 '<li>.mat for Matlab format</li></ul>']}, paramValue.EMPTY_STRING);
697 pl.append(p);
698
699 % Filename prefix
700 p = param({'prefix', 'Filename prefix'}, paramValue.EMPTY_STRING);
701 pl.append(p);
702
703 % Filename postfix
704 p = param({'postfix', 'Filename postfix'}, paramValue.EMPTY_STRING);
705 pl.append(p);
706
707 % Individual Files
708 p = param({'individual files', 'Save the objects into Individual files'}, paramValue.FALSE_TRUE);
709 pl.append(p);
710
711 end
712
713 function pl = AXIS_3D_PLIST
714 pl = plist();
715 p = param({'axis', 'The axis on which to apply the method.'}, ...
716 {3, {'x', 'y', 'z', 'xyz'}, paramValue.SINGLE});
717 pl.append(p);
718
719 p = param({'dim', ['The dimension of the chosen vector to apply the method '...
720 'to. This is necessary for functions like mean() when ' ...
721 'applied to matrices held in cdata objects. For tsdata, '...
722 'fsdata or xydata, this option has no effect.']}, paramValue.EMPTY_DOUBLE);
723 pl.append(p);
724
725 p = param({'option', 'Any additional option to pass to the method.'}, paramValue.EMPTY_STRING);
726 pl.append(p);
727
728 end
729
730 function pl = AXIS_2D_PLIST
731 pl = plist();
732 p = param({'axis', 'The axis on which to apply the method.'}, ...
733 {2, {'x', 'y', 'xy'}, paramValue.SINGLE});
734 pl.append(p);
735
736 p = param({'dim', ['The dimension of the chosen vector to apply the method '...
737 'to. This is necessary for functions like mean() when ' ...
738 'applied to matrices held in cdata objects. For tsdata, '...
739 'fsdata or xydata, this option has no effect.']}, paramValue.EMPTY_DOUBLE);
740 pl.append(p);
741
742 p = param({'option', 'Any additional option to pass to the method.'}, paramValue.EMPTY_STRING);
743 pl.append(p);
744
745 end
746
747 function plout = EMPTY_PLIST
748 persistent pl;
749 if ~exist('pl', 'var') || isempty(pl) || pl.nparams>0
750 pl = plist();
751 end
752 plout = pl;
753 end
754
755 function pl = AXIS_1D_PLIST
756 pl = plist();
757 p = param({'axis', 'The axis on which to apply the method.'}, ...
758 {1, {'y'}, paramValue.SINGLE});
759 pl.append(p);
760
761 p = param({'dim', ['The dimension of the chosen vector to apply the method '...
762 'to. This is necessary for functions like mean() when ' ...
763 'applied to matrices held in cdata objects. For tsdata, '...
764 'fsdata or xydata, this option has no effect.']}, paramValue.EMPTY_DOUBLE);
765 pl.append(p);
766
767 p = param({'option', 'Any additional option to pass to the method.'}, paramValue.EMPTY_STRING);
768 pl.append(p);
769
770 end
771
772 function obj = initObjectWithSize(n,m)
773 obj = plist.newarray([n m]);
774 end
775
776 varargout = ltp_parameters(varargin)
777
778 end
779
780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
781 % Methods (static, hidden) %
782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
783
784 methods (Static = true, Hidden = true)
785 varargout = loadobj(varargin)
786 varargout = update_struct(varargin)
787 end
788
789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
790 % Methods (Private) %
791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
792
793 methods (Access = private)
794 end
795
796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797 % Methods (Hidden) %
798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
799 methods (Hidden = true)
800 varargout = sort(varargin)
801 varargout = applyDefaults(varargin)
802 end
803
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 % Methods (public) %
806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
807
808 methods
809 %%% Define Abstract methods
810 varargout = char(varargin)
811 varargout = copy(varargin)
812 varargout = display(varargin)
813 varargout = string(varargin)
814
815 %%% Define other methods
816 varargout = append(varargin)
817 varargout = combine(varargin)
818 varargout = find(varargin)
819 varargout = isparam(varargin)
820 varargout = nparams(varargin)
821 varargout = pset(varargin)
822 varargout = remove(varargin)
823
824
825 varargout = setDescriptionForParam(varargin)
826 varargout = setDefaultForParam(varargin)
827 varargout = setOptionsForParam(varargin)
828 varargout = setSelectionForParam(varargin)
829
830 varargout = getOptionsForParam(varargin)
831 varargout = getSelectionForParam(varargin)
832 varargout = getDescriptionForParam(varargin)
833 varargout = getKeys(varargin)
834
835 varargout = setPropertyForKey(varargin)
836 varargout = getPropertyForKey(varargin)
837
838 end
839
840 methods (Hidden = true)
841 varargout = attachToDom(varargin)
842 end
843
844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
845 % Methods (protected) %
846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
847
848 methods (Access = protected)
849 varargout = fromRepository(varargin)
850 varargout = fromFile(varargin)
851 varargout = fromStruct(varargin)
852 varargout = fromDom(varargin)
853 varargout = processSetterValues(varargin)
854 end
855
856 end % Class
857
858