Commit 505d9a5140821b80d342037f999e3f04128d1619
1 parent
e5aeec4913
Exists in
master
add compatibility with multiple entries
Showing 1 changed file with 28 additions and 6 deletions Inline Diff
temp2allan.m
#!/usr/bin/octave-cli | 1 | 1 | #!/usr/bin/octave-cli | |
2 | 2 | |||
filename = argv(){1}; | 3 | 3 | filename = argv(){1}; | |
col = eval(argv(){2}); | 4 | 4 | col = eval(argv(){2}); | |
mult = eval(argv(){3}); | 5 | 5 | mult = eval(argv(){3}); | |
6 | 6 | |||
data.freq = load(filename)(:,col).*mult; | 7 | 7 | filename = argv(){1}; | |
data.rate = 1; | 8 | 8 | col = eval(argv(){2}); | |
9 | mult = eval(argv(){3}); | |||
10 | ad_opt = eval(argv(){4}); | |||
9 | 11 | |||
[ad, s, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, '', 0); | 10 | 12 | if length(col) == length(mult) | |
tosave = vertcat(tau, ad, err)'; | 11 | 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 | |||
save('-ascii', strcat(strsplit(filename, '.'){1}, '_ad.dat'), 'tosave'); | 12 | 35 | save('-ascii', strcat(strsplit(filename, '.'){1}, '_ad.dat'), 'tosave'); | |
13 | 36 | end | ||
exit | 14 | |||
15 | 37 |