clear all
%addpath C:\Users\Sheila2\Documents\MATLAB\alm-master

beam=beamPath;
beam.seedWaist(3.3e-3, 0);

f=0.6875;
lensPos=0.05;
beam.addComponent(component.lens(f,0.4, 'lens1'));
beam.addComponent(component.lens(0.143,0.67 ,'lens2'));

zplot=0:0.001:0.8;
figure(2)
beam.plotSummary(zplot)
lens1dist=beam.components(1).z/0.0254
lens2dist=beam.components(2).z/0.0254
waistDist=(0.7-beam.qPropagate(0.7).waistZ)/0.0254
InchesfromSteering=(waistDist-0.584)/0.0254
beam.qPropagate(0.7).waistSize

beam.targetWaist(18e-6, 0.65)


focalLengthList = [0.143;0.6875;1];
lensList = component.lens(focalLengthList);

% tic;
% [pathList,overlapList] = beam.chooseComponents(...
%                 'lens1',lensList,[-0.3, 0.6],...  % choose lens1 from the list,
%                 'lens2',lensList.duplicate,[0, 0.65],... %duplicate the list, this allows
%                 ...                                    %  the same component to be chosen more than once
%                 'target',[0.65, 0.85]... % we can also allow the target waist position to vary while optimizing the overlap
%                 ,'-vt',.01); % set the minimum initial overlap to 0.25, if a combination of components
%                             % has an overlap less than this, it will be skipped without trying to optimize the lens positions
% toc
% 
% 
% bestPath=pathList(1);
% 
% print the component list to the command window
% disp(' ')
% disp(' Optimized Path Component List:')
% display(bestPath.components)
% 
% figure(1)
% bestPath.plotSummary(zplot);
% 
% distances in inches
% lens2dist=bestPath.components(1).z/0.0254
% lens1dist=bestPath.components(2).z/0.0254
% waistDist=(0.6-bestPath.qPropagate(0.6).waistZ)/0.0254
% 
% 
% 
% 