0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % LINEDETECT find spectral lines in the ao/fsdata objects.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: LINEDETECT find spectral lines in the ao/fsdata objects.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CALL: b = linedetect(a, pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'linedetect')">Parameters Description</a>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % VERSION: $Id: linedetect.m,v 1.15 2011/04/08 08:56:16 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 function varargout = linedetect(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % Check if this is a call for parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 if utils.helper.isinfocall(varargin{:})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 varargout{1} = getInfo(varargin{3});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 if nargout == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 error('### cat cannot be used as a modifier. Please give an output variable.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % Collect input variable names
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 in_names = cell(size(varargin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 for ii = 1:nargin,in_names{ii} = inputname(ii);end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % Collect all AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 [pli, pl_invars] = utils.helper.collect_objects(varargin(:), 'plist', in_names);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % Decide on a deep copy or a modify
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 bs = copy(as, nargout);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 Na = numel(bs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 if isempty(bs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 error('### Please input at least one AO.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % Combine plists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 if ~isempty(pli)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 pl = parse(pli, getDefaultPlist());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 pl = getDefaultPlist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % Get parameters from plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 N = find(pl, 'N');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 fsearch = find(pl, 'fsearch');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 thresh = find(pl, 'thresh');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % Loop over input AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 for jj = 1:Na
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 if isa(bs(jj).data, 'fsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % Make noise-floor estimate
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 nf = smoother(bs(jj), pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % Make ratio
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 r = bs(jj)./nf;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % find lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 lines = findLines(bs(jj).data.getY, r.data.getX, r.data.getY, thresh, N, fsearch);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 f = [lines(:).f];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 y = [lines(:).a];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 % Keep the data shpare of the input AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 if size(bs(jj).data.y, 2) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 f = f.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 y = y.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 % Make output data: copy the fsdata object so to inherit all the feautures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 fs = copy(bs(jj).data, 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 % Make output data: set the values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 fs.setX(f);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 fs.setY(y);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 error('### I can only find lines in frequency-series AOs.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 %------- Make output AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 % make output analysis object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 bs(jj).data = fs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 bs(jj).name = sprintf('lines(%s)', ao_invars{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 bs(jj).addHistory(getInfo('None'), pl, ao_invars(jj), bs(jj).hist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 % Set output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 if nargout == numel(bs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % List of outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 for ii = 1:numel(bs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 varargout{ii} = bs(ii);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 % Single output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 varargout{1} = bs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % find spectral lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 function lines = findLines(ay, f, nay, thresh, N, fsearch)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % look for spectral lines
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 l = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 pmax = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 pmaxi = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 line = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 idx = find( f>=fsearch(1) & f<=fsearch(2) );
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 for jj = 1:length(idx)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 v = nay(idx(jj));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 if v > thresh
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 if v > pmax
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 pmax = v;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 pmaxi = idx(jj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 if pmax > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % find index when we have pmax
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 fidx = pmaxi; %(find(nay(1:idx(jj))==pmax));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 l = l+1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 line(l).idx = fidx;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 line(l).f = f(fidx);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 line(l).a = ay(fidx);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 pmax = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 % Select largest peaks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 lines = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 if ~isempty(line)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 [bl, lidx] = sort([line.a], 'descend');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 lidxs = lidx(1:min([N length(lidx)]));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 lines = line(lidxs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 disp(sprintf(' + found %d lines.', length([lines.f])));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 disp(' + found 0 lines.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 % Local Functions %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 % FUNCTION: getInfo
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 % DESCRIPTION: Get Info Object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 % HISTORY: 11-07-07 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 % Creation.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 function ii = getInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 if nargin == 1 && strcmpi(varargin{1}, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 sets = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 pl = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 sets = {'Default'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 pl = getDefaultPlist;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 % Build info object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.sigproc, '$Id: linedetect.m,v 1.15 2011/04/08 08:56:16 hewitson Exp $', sets, pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 ii.setModifier(false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 % FUNCTION: getDefaultPlist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 % DESCRIPTION: Get Default Plist
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 % HISTORY: 11-07-07 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 % Creation.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 function plout = getDefaultPlist()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 persistent pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 if exist('pl', 'var')==0 || isempty(pl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 pl = buildplist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 plout = pl;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 function pl = buildplist()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 pl = plist();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 % N
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 p = param({'N', 'The maximum number of lines to return.'}, {1, {10}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 % fsearch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 p = param({'fsearch', 'The frequency search interval.'}, {1, {[0 1e10]}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 % thresh
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 p = param({'thresh', 'A threshold to test normalised amplitude against. (A sort-of SNR threshold.)'}, {1, {2}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 % BW
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 p = param({'bw', ['The bandwidth of the running median filter used to<br>'...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 'estimate the noise-floor.']}, {1, {20}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 % HC
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 p = param({'hc', 'The cutoff used to reject outliers (0-1).'}, {1, {0.8}, paramValue.OPTIONAL});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 pl.append(p);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 % PARAMETERS: N - max number of lines to return [default: 10]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 % fsearch - freqeuncy search interval [default: all]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 % thresh - a threshold to test normalised amplitude spectrum against
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 % [default: 2]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % bw - bandwidth over which to compute median [default: 20 samples]
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 % hc - percent of outliers to exclude from median estimation (0-1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 % [default: 0.8]
|