%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script prepares some variables for the sweep functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% create the model
opt = optLIGO2;
[vFrf, vArf] = getFieldSource(opt);
aMax = max(abs(vArf));
nSBa = find(abs(vArf) > aMax / 10);
nSBb = find(abs(vArf) <= aMax / 10);

% get the serial numbers of some optics
nPR = getDriveIndex(opt, 'PR');
nSR = getDriveIndex(opt, 'SR');
nBS = getDriveIndex(opt, 'BS');
nIX = getDriveIndex(opt, 'IX');
nIY = getDriveIndex(opt, 'IY');
nEX = getDriveIndex(opt, 'EX');
nEY = getDriveIndex(opt, 'EY');
nOMCa = getDriveIndex(opt, 'OMCa');
nOMCb = getDriveIndex(opt, 'OMCb');
nSrc = getDriveIndex(opt, 'Source');

% probe names and numbers
oprb = opt.probe;
prbNames = {oprb.name};

nREFL = strmatch('REFL', prbNames);
nAS = strmatch('AS', prbNames);
nASp = strmatch('ASp', prbNames);
nPOX = strmatch('POX', prbNames);
nPOY = strmatch('POY', prbNames);
nTRX = strmatch('TRX', prbNames);  
nTRY = strmatch('TRY', prbNames);  
nOMC = strmatch('OMR', prbNames);  
