Skip to content
Snippets Groups Projects
Commit 09a9ef45 authored by Charlotte Bond's avatar Charlotte Bond
Browse files

can now take files with no maxtem/maxtem off and turn off prm and srm for all...

can now take files with no maxtem/maxtem off and turn off prm and srm for all mirror/bs definitions (m,m1,m2 etc.)
parent 250f6e38
Branches
No related tags found
No related merge requests found
......@@ -95,11 +95,9 @@ function [tunings] = FT_DR_FP_MICH_initial_tuning(infile,outfile,commands,mirror
relative_err = 1e-2;
% Number of zooms
zooms = 3;
% Number of points and ranges for the first and second round of scans
npoints = 5000;
% Number of points and ranges for the scans
npoints = 300;
range = 90;
zoom_npoints = 500;
zoom_range = 90;
% Initilise Finesse
FT = FT_init_Finesse();
......@@ -132,7 +130,7 @@ function [tunings] = FT_DR_FP_MICH_initial_tuning(infile,outfile,commands,mirror
npty = nodes{2};
nas = nodes{3};
npop = nodes{4};
npox = nodes{5};
npos = nodes{5};
% Read in the mirror parameters from blocks
[R_ETMX,T_ETMX,L_ETMX,phi_ETMX] = FT_read_mirror_parameters_from_blocks(blocks,etmx);
......@@ -149,27 +147,52 @@ function [tunings] = FT_DR_FP_MICH_initial_tuning(infile,outfile,commands,mirror
% Read in intial maxtem
maxtem = FT_read_maxtem_from_blocks(blocks);
if isnan(maxtem)==0
% Start off with maxtem at minimum (i.e. max order of tem modes)
[gc,max_order] = FT_read_TEM_from_blocks(blocks);
blocks = FT_replace_maxtem_in_blocks(blocks,max_order);
end
% Perform tunigns twice, once with maxtem 0 and once with the value for
% maxtem set in infile
for i=1:2
%======================================================================
%============ 1. Tuning arm cavities to be on resonance ===============
%======================================================================
% Setting R_PRM=0
if ~strcmp(prm,'off')
[bi,li,mtype_prm] = FT_find_mirror_in_blocks(blocks,prm);
if mtype_prm==0 || mtype_prm==2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'R',0);
end
if mtype_prm<2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'T',1);
end
if mtype_prm>0
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'L',0);
end
end
% Setting R_SRM=0
if ~strcmp(srm,'off')
[bi,li,mtype_srm] = FT_find_mirror_in_blocks(blocks,srm);
if mtype_srm==0 || mtype_srm==2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'R',0);
end
if mtype_srm<2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'T',1);
end
if mtype_srm>0
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'L',0);
end
end
if strcmp(srm,'off')
ntimes = 2;
else
ntimes = 3;
end
% Perform tunigns twice, once with maxtem 0 and once with the value for
% maxtem set in infile
for i=1:ntimes
%======================================================================
%============ 1. Tuning arm cavities to be on resonance ===============
%======================================================================
%----------------------------------------------------------------------
% Tuning the x arm cavity
tuning = phi_ETMX;
......@@ -223,9 +246,15 @@ function [tunings] = FT_DR_FP_MICH_initial_tuning(infile,outfile,commands,mirror
%======= 3. Tuning PRM to maximise power at POP port ==========
%==============================================================
% Set PRM reflectivity back to normal
if mtype_prm==0 || mtype_prm==2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'R',R_PRM);
end
if mtype_prm<2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'T',T_PRM);
end
if mtype_prm>0
blocks = FT_replace_mirror_parameter_in_blocks(blocks,prm,'L',L_PRM);
end
% Tuning the power-recyling cavity
tuning = phi_PRM;
tuning = scan_for_operating_point(FT,Run1,blocks,prm,npop,tuning,range,npoints,'max',relative_err,zooms,debug(4));
......@@ -245,35 +274,41 @@ function [tunings] = FT_DR_FP_MICH_initial_tuning(infile,outfile,commands,mirror
% HOMs can greatly effect SRM tuning, so return to original maxtem
% at this point.
if isnan(maxtem)==0
blocks = FT_replace_maxtem_in_blocks(blocks,maxtem);
end
if ~strcmp(srm,'off')
if i==2
%==============================================================
%======= 4. Tuning SRM to maximise power at POX port ==========
%========= 4. Tuning SRM for broadband SRM tuning =============
%==============================================================
% Set SRM reflectivity back to normal
if mtype_srm==0 || mtype_srm==2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'R',R_SRM);
end
if mtype_srm<2
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'T',T_SRM);
end
if mtype_srm>0
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'L',L_SRM);
end
% Tuning the signal recycling cavity
tuning = phi_SRM;
tuning = scan_for_operating_point(FT,Run1,blocks,srm,npox,tuning,range,npoints,'max',relative_err,zooms,debug(4));
tuning = scan_for_operating_point(FT,Run1,blocks,srm,npos,tuning,range,npoints,'min',relative_err,zooms,debug(4));
if abs(tuning) < tuning_threshold
tuning=0.0;
end
% Setting BS tuning
phi_SRM = tuning;
phi_SRM = tuning+srm_tuning;
blocks = FT_replace_mirror_parameter_in_blocks(blocks,srm,'phi',phi_SRM);
fprintf('setting %s tuning to %f\n',srm,phi_SRM);
%==============================================================
%==============================================================
end
% And use smaller range and number of points
range = zoom_range;
npoints = zoom_npoints;
end
end
......@@ -344,9 +379,9 @@ function [tuning] = scan_for_operating_point(FT,Run,blocks,mirror,node,x0,range,
% Find the operating point
if strcmp(op_point,'max')
new_tuning = Run.x(max(find(Run.y==max(Run.y))));
new_tuning = Run.x(max(find(Run.y(:,1)==max(Run.y(:,1)))));
elseif strcmp(op_point,'min')
new_tuning = Run.x(max(find(Run.y==min(Run.y))));
new_tuning = Run.x(max(find(Run.y(:,1)==min(Run.y(:,1)))));
end
% Relaive difference from previous operating point
......@@ -362,7 +397,7 @@ function [tuning] = scan_for_operating_point(FT,Run,blocks,mirror,node,x0,range,
% Plot scan if required
if verbose==1
figure
semilogy(Run.x,Run.y)
semilogy(Run.x,Run.y(:,1))
xlabel(sprintf('%s tuning [phi]',mirror))
ylabel(sprintf('carrier amplitude (%s) [a.u.]',node))
drawnow;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment