run /users/swinkels/deploy/MatlabVirgoTools/trunk/startup.m dt = 200; % for filter transient gstart = utc2gps(2016, 10, 24, 19, 26, 0) - dt; gstop = utc2gps(2016, 10, 24, 19, 47, 0); [tx, ty, pwr, t] = getChannels('rds', {'Sc_BS_MAR_TX_50Hz', 'Sc_BS_MAR_TY_50Hz', ... 'PAY_WE_MIR_UR_Pwr'}, gstart, gstop); fsample = 1 / (t(2) - t(1)); t = t - dt; pwr = pwr - min(pwr); tx = tx - median(tx); ty = ty - median(ty); vtx1 = (60 < t & t < 260); vtx2 = (775 < t & t < 950); vty1 = (350 < t & t < 550); vty2 = (1000 < t & t < 1175); %% demod ftx = 2; fty = 1.8; phi_tx = 0; phi_ty = deg2rad(160); tx_sin = sin(2*pi*t*ftx + phi_tx); tx_cos = cos(2*pi*t*ftx + phi_tx); ty_cos = cos(2*pi*t*fty + phi_ty); ty_sin = sin(2*pi*t*fty + phi_ty); fcut = 0.05; [B, A] = butter(4, fcut * 2 / fsample); txsf = filter(B,A, tx_sin .* pwr); txcf = filter(B,A, tx_cos .* pwr); tysf = filter(B,A, ty_sin .* pwr); tycf = filter(B,A, ty_cos .* pwr); % filter optical lever signals to get rid of line fcut = 1; [B, A] = butter(4, fcut * 2 / fsample); txf = filtfilt(B,A, tx); tyf = filtfilt(B,A, ty); %% multiPlot({t, tx, t, ty}, {t, pwr}, {t, txsf, t, txcf}, {t, tysf, t, tycf}, ... 'title', {'optical levers', 'marker power', 'TX demod', 'TY demod'}, ... 'ylabel', {'urad', 'counts', 'a.u.', 'a.u.'}, ... 'xlabel', sprintf('Time (s) after %s', gps2str(gstart))) xlim([0, 1200]) subplot(411) legend('BS\_MAR\_TX', 'BS\_MAR\_TY') subplot(413) legend('I', 'Q') subplot(414) legend('I', 'Q') %% cali_tx = -0.0025; plot(txf, cali_tx * mask(vtx1) .* txsf, txf, cali_tx * mask(vtx2) .* txsf, txf, txf); grid; axis([-10,10,-3, 3]) legend('fast scan', 'slow scan', 'linear') xlabel('BS\_MAR\_TX (urad)') ylabel('calibrated error signal (urad)') %% cali_ty = 0.002; plot(tyf, cali_ty * mask(vty1) .* tysf, tyf, cali_ty * mask(vty2) .* tysf, tyf, tyf); grid; axis([-10, 10, -3, 3]) legend('fast scan', 'slow scan', 'linear') xlabel('BS\_MAR\_TY (urad)') ylabel('calibrated error signal (urad)')