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

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

% 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');
nSrc = getDriveIndex(opt, 'Source');

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

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