0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % XSPEC performs cross-spectral analysis of various forms.
|
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: XSPEC performs cross-spectral analysis of various forms.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % The function is a helper function for various higher level
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % functions. It is meant to be called from other functions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % (e.g., tfe).
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % CALL: b = xspec(a, pl, method, iALGO, iVER, invars);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % INPUTS: a - vector of 2 input AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % pl - input parameter list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % method - one of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % 'cpsd' - compute cross-spectral density
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % 'tfe' - estimate transfer function between inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % 'mscohere' - estimate magnitude-squared cross-coherence
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % 'cohere' - estimate complex cross-coherence
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % iALGO - ALGONAME from the calling higher level script
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % iVER - VERSION from the calling higher level script
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % invars - invars variable from the calling higher level script
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % OUTPUTS: b - output AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %
|
43
|
24 % VERSION: $Id: xspec.m,v 1.62 2011/12/01 08:51:11 hewitson Exp $
|
0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % HISTORY: 30-05-2007 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 function varargout = xspec(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % unpack inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 as = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 pl = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 method = varargin{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 mi = varargin{4};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 invars = varargin{5};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41
|
43
|
42 VERSION = '$Id: xspec.m,v 1.62 2011/12/01 08:51:11 hewitson Exp $';
|
0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % Set the method version string in the minfo object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 mi.setMversion([VERSION '-->' mi.mversion]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 %----------------- Select all AOs with time-series data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 tsao = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 for ll = 1:numel(as)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 if isa(as(ll).data, 'tsdata')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 tsao = [tsao as(ll)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 warning('### xspec requires tsdata (time-series) inputs. Skipping AO %s. \nREMARK: The output doesn''t contain this AO', invars{ll});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 if numel(tsao) ~= 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 error('### XSPEC needs two time-series AOs.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 %----------------- Gather the input history objects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 inhists = [tsao(:).hist];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 %----------------- Check the time range
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 time_range = mfind(pl, 'split', 'times');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 for ll = 1:numel(tsao)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 if ~isempty(time_range)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 switch class(time_range)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 case 'double'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 tsao(ll) = split(tsao(ll), plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 'times', time_range));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 case 'timespan'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 tsao(ll) = split(tsao(ll), plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 'timespan', time_range));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 case 'time'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 tsao(ll) = split(tsao(ll), plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 'start_time', time_range(1), ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 'end_time', time_range(2)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 tsao(ll) = split(tsao(ll), plist(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 'start_time', time_range{1}, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 'end_time', time_range{2}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 if tsao(ll).len <= 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 error('### The object is empty! Please revise your settings ...');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 end
|
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 %----------------- Resample all AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 copies = zeros(size(tsao));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 fsmin = ao.findFsMin(tsao);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 fspl = plist(param('fsout', fsmin));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 for ll = 1:numel(tsao)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 % Check Fs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 if tsao(ll).data.fs ~= fsmin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 utils.helper.msg(msg.PROC1, 'resampling AO %s to %f Hz', tsao(ll).name, fsmin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 % Make a deep copy so we don't
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % affect the original input data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 tsao(ll) = copy(tsao(ll), 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 copies(ll) = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 resample(tsao(ll), fspl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 %----------------- Truncate all vectors
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % Get shortest vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 lmin = ao.findShortestVector(tsao);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 nsecs = lmin / fsmin;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 for ll = 1:numel(tsao)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 if len(tsao(ll)) ~= lmin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 utils.helper.msg(msg.PROC2, 'truncating AO %s to %d secs', tsao(ll).name, nsecs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 % do we already have a copy?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 if ~copies(ll)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 % Make a deep copy so we don't
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 % affect the original input data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 tsao(ll) = copy(tsao(ll), 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 copies(ll) = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 tsao(ll).select(1:lmin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 end
|
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 %----------------- check input parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 usepl = utils.helper.process_spectral_options(pl, 'lin', lmin, fsmin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 % Loop over input AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 utils.helper.msg(msg.PROC1, 'computing %s(%s -> %s)', method, invars{1}, invars{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 % -------- Make Xspec estimate
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 % Compute xspec using welch and always scale to PSD
|
43
|
136 if usepl.find('newmethod')
|
|
137 [txy, f, info, dev] = ao.wosa(tsao(1), tsao(2), method, usepl.pset('Scale', 'PSD'));
|
|
138 else
|
|
139 [txy, f, info, dev] = welch(tsao(1), tsao(2), method, usepl.pset('Scale', 'PSD'));
|
|
140 end
|
|
141
|
0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 % Keep the data shape of the first input AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 if size(tsao(1).data.y,1) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 txy = txy.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 f = f.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 dev = dev.';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 % create new output fsdata
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 fsd = fsdata(f, txy, fsmin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 fsd.setEnbw(info.enbw);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 fsd.setXunits('Hz');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 switch lower(method)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 case 'tfe'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 fsd.setYunits(tsao(2).data.yunits / tsao(1).data.yunits);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 case 'cpsd'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 fsd.setYunits(tsao(2).data.yunits * tsao(1).data.yunits / unit('Hz'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 case {'mscohere','cohere'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 fsd.setYunits(unit());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 error(['### Unknown method:' method]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 fsd.setNavs(info.navs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 % set object t0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 if eq(tsao(1).t0, tsao(2).t0)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 fsd.setT0(tsao(1).t0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 % make output analysis object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 bs = ao(fsd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 % add variance
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 bs.data.dy = dev;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 % simplify the units in the case of cpsd calculation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 if strcmp(method, 'cpsd')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 bs.simplifyYunits(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 plist('prefixes', false, 'exceptions', 'Hz'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 %----------- Add history
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 % set name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 bs.name = sprintf('%s(%s->%s)', upper(method), invars{1}, invars{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 % we need to get the input histories in the same order tsao the inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % to this function call, not in the order of the input to xspec;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 % otherwise the resulting matrix on a 'create from history' will be
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % mirrored.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 bs.addHistory(mi, usepl, [invars(:)], inhists);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % Propagate 'plotinfo'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 if ~isempty(tsao(1).plotinfo) || ~isempty(tsao(2).plotinfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 bs.plotinfo = combine(tsao(1).plotinfo, tsao(2).plotinfo);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 % Set output
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 varargout{1} = bs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201
|