[go: up one dir, main page]

Menu

[73c35b]: / m165KST / integr_NW.m  Maximize  Restore  History

Download this file

52 lines (44 with data), 1.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
% integr_NW: Interface to Nigel Wade's integration package (mex call)
% GUISDAP v1.60 96-05-27 Copyright Asko Huuskonen, Markku Lehtinen
%
% Interface to Nigel Wade's integration package (mex call)
% Parameters:
% a_integdeffile : the integration definition file
% OK : if true, the integration was succesful
% EOF : if true, the end of file was found during integration
% global parameters:
% d_parbl : the parameter block returned by the integration program
% d_data : the integrated data vector
% d_var1 d_var2: data variances
%
% See also: an_start integr_data integrate
%
% function [OK,EOF]=integr_NW(a_integdeffile)
function [OK,EOF]=integr_NW(a_integdeffile)
global d_parbl d_data d_var1 d_var2 a_control a_integdeffile
if ~isempty(a_integdeffile)
[status,d1,N_averaged,par,d_parbl,d_data,d_var1,d_var2,scan]=...
integrate(['-id ',a_integdeffile]);
a_integdeffile=[];
else
[status,d1,N_averaged,par,d_parbl,d_data,d_var1,d_var2,scan]=integrate;
end
if status==0, OK=1; EOF=0;
elseif status>0, OK=1; EOF=1;
elseif status<0, OK=0; EOF=0; fprintf(' Error in integration\n'); return, end
% If no files found, the routine returns empty matrices, exit here
if length(N_averaged)==0, OK=0; return; end
d_data=d_data(:);
d_var1=d_var1(:)-d_data.*d_data/N_averaged;
d_var2=d_var2(:)-d_data.*conj(d_data)/N_averaged;
if a_control(4)==1 & N_averaged<2,
fprintf(' One file is not enough for variance determination\n')
fprintf(' Skipping this integration period\n')
fprintf(' command ''analysis_control(4)=2'' in the startup file will enable the analysis\n')
OK=0;
return
elseif a_control(4)==1 & N_averaged<5,
fprintf(' ******************* WARNING **********************************\n')
fprintf(' %.0f files may not be enough for reliable variance determination\n',N_averaged)
fprintf(' ******************* WARNING **********************************\n')
end