% Plotting detuning waveforms computed by piezo server

% Example file to load from Saturday 5th Feb
load('/home/ttflinac/user/carwar/9mA_studies_Feb2011/matlab/data/flattop_scan_20110205T113742.mat');

% waveforms collected at each step are in the following arrays
% det_wf6{}
% det_wf7{}


% example plot cmd
cav = 5;
step_num = 1;   % step number in the scan: step 1 has flat-top length of 800us (ie full pulse length)
sample_start = 350; % in microseconds

% This cmd plots cavity 5 of ACC7 from 350us from start of rf pulse to the end of the waveform
plot(det_wf7{cav}(step_num).data.array(sample_start:end))
title(['ACC7 Cavity' num2str(cav)])
xlabel('Computed detuning (Hz)');
ylabel(['Time in microseconds starting from ',num2str(sample_start),'us into rf pulse'])

