From 505d9a5140821b80d342037f999e3f04128d1619 Mon Sep 17 00:00:00 2001 From: bma Date: Wed, 4 Apr 2018 16:20:01 +0200 Subject: [PATCH] add compatibility with multiple entries --- temp2allan.m | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/temp2allan.m b/temp2allan.m index 1971d13..73c511e 100755 --- a/temp2allan.m +++ b/temp2allan.m @@ -4,11 +4,33 @@ filename = argv(){1}; col = eval(argv(){2}); mult = eval(argv(){3}); -data.freq = load(filename)(:,col).*mult; -data.rate = 1; +filename = argv(){1}; +col = eval(argv(){2}); +mult = eval(argv(){3}); +ad_opt = eval(argv(){4}); -[ad, s, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, '', 0); -tosave = vertcat(tau, ad, err)'; +if length(col) == length(mult) + for i = [1:length(col)] + data.freq = load(filename)(:,col(i)).*mult(i); + if nargin == 4 + if ad_opt(i) == 1 + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed\n\n')) + data.freq = detrend(data.freq); + elseif ad_opt(i) == 2 + printf(strcat(filename, ' col', num2str(col(i)), ' relative ad : mean=', num2str(mean(data.freq)), '\n\n')) + data.freq = data.freq./mean(data.freq); + elseif ad_opt(i) == 3 + printf(strcat(filename, ' col', num2str(col(i)), ' drift removed relative ad\n\n')) + data.freq = detrend(data.freq./mean(data.freq)); + end + endif + data.rate = 1; + [ad, S, err, tau] = allan(data, 2.^[0:nextpow2(length(data.freq))-3]./data.rate, strcat(strsplit(filename, '/'){end}, num2str(i)), 0); + ad_tosave{i} = vertcat(ad, err)'; + end +tosave = tau'; +for i = [1:length(col)] + tosave = horzcat(tosave, ad_tosave{i}); +end save('-ascii', strcat(strsplit(filename, '.'){1}, '_ad.dat'), 'tosave'); - -exit +end -- 2.16.4