Commit 505d9a5140821b80d342037f999e3f04128d1619
1 parent
e5aeec4913
Exists in
master
add compatibility with multiple entries
Showing 1 changed file with 28 additions and 6 deletions Side-by-side Diff
temp2allan.m
... | ... | @@ -4,12 +4,34 @@ |
4 | 4 | col = eval(argv(){2}); |
5 | 5 | mult = eval(argv(){3}); |
6 | 6 | |
7 | -data.freq = load(filename)(:,col).*mult; | |
8 | -data.rate = 1; | |
7 | +filename = argv(){1}; | |
8 | +col = eval(argv(){2}); | |
9 | +mult = eval(argv(){3}); | |
10 | +ad_opt = eval(argv(){4}); | |
9 | 11 | |
10 | -[ad, s, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, '', 0); | |
11 | -tosave = vertcat(tau, ad, err)'; | |
12 | +if length(col) == length(mult) | |
13 | + for i = [1:length(col)] | |
14 | + data.freq = load(filename)(:,col(i)).*mult(i); | |
15 | + if nargin == 4 | |
16 | + if ad_opt(i) == 1 | |
17 | + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) | |
18 | + data.freq = detrend(data.freq); | |
19 | + elseif ad_opt(i) == 2 | |
20 | + printf(strcat(filename, ' col', num2str(col(i)), ' relative ad : mean=', num2str(mean(data.freq)), '\n\n')) | |
21 | + data.freq = data.freq./mean(data.freq); | |
22 | + elseif ad_opt(i) == 3 | |
23 | + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) | |
24 | + data.freq = detrend(data.freq./mean(data.freq)); | |
25 | + end | |
26 | + endif | |
27 | + data.rate = 1; | |
28 | + [ad, S, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0); | |
29 | + ad_tosave{i} = vertcat(ad, err)'; | |
30 | + end | |
31 | +tosave = tau'; | |
32 | +for i = [1:length(col)] | |
33 | + tosave = horzcat(tosave, ad_tosave{i}); | |
34 | +end | |
12 | 35 | save('-ascii', strcat(strsplit(filename, '.'){1}, '_ad.dat'), 'tosave'); |
13 | - | |
14 | -exit | |
36 | +end |