close all
clear all
clc

%%
printFigs = true;
authorId = ', J. Kissel';

seiRepoHome = '/home/jkissel/SeismicSVN/seismic/';
dataDir = [seiRepoHome 'HAM-ISI/LLO/Data/'];
susModelDir = [seiRepoHome 'Common/MatlabTools/SusModels/'];
hstsDir = [susModelDir 'HAMSmallTriple_T080311/'];
hltsDir = [susModelDir 'HAMLargeTriple_T080310/'];
reqDir = [seiRepoHome 'HAM-ISI/Common/MatlabTools/'];
resultsDir = [seiRepoHome 'HAM-ISI/Common/DataAnalysis/'];
dataFileName = 'L1HAM6ISI_100324_PerformanceData.mat';

freqRange = [0.5 100];
dispRange = [1e-23 1e-11];
dispTicks = 10.^(-23:-11);
forceRange = [1e-19 1e-9];
forceTicks = 10.^(-19:-9);

colorTable = [0.0 0.0 1.0;... % T020059
              0.2 0.2 0.2;... % eLIGO ISI
              1.0 0.4 0.0;... % PRCL ISI
              1.0 0.7 0.0];   % SRCL ISI
%% Add Paths
addpath(dataDir)
addpath(hstsDir)
addpath(hltsDir)
addpath(reqDir)

%% Get L1 HAM6 ISI Performance
load([dataDir dataFileName]);
w = 2*pi*freq;
my_colors;

%% Get SUS Models
% HSTS
hstsModel = load([hstsDir 'HSTS_Model.mat']);
hstsModel.cage2botm.long = ...
    abs(squeeze(hstsModel.HSTS_freqresp(hstsModel.out.long_mirror,hstsModel.in.long_gnd,:)));  % [m/m]
hstsModel.botmdrive2botm.long = ...
    abs(squeeze(hstsModel.HSTS_freqresp(hstsModel.out.long_mirror,hstsModel.in.long_bot_drive,:))); % [m/N]
hstsModel.midldrive2botm.long = ...
    abs(squeeze(hstsModel.HSTS_freqresp(hstsModel.out.long_mirror,hstsModel.in.long_mid_drive,:))); % [m/N]

hsts.cage2botm.long = interp1(hstsModel.freq,hstsModel.cage2botm.long,freq);
hsts.botmdrive2botm.long = interp1(hstsModel.freq,hstsModel.botmdrive2botm.long,freq);
hsts.midldrive2botm.long = interp1(hstsModel.freq,hstsModel.midldrive2botm.long,freq);

% HLTS
hltsModel = load([hltsDir 'HLTS_Model.mat']);
hltsModel.cage2botm.long = ...
    abs(squeeze(hltsModel.HLTS_freqresp(hltsModel.out.long_mirror,hltsModel.in.long_gnd,:)));  % [m/m]
hltsModel.botmdrive2botm.long = ...
    abs(squeeze(hltsModel.HLTS_freqresp(hltsModel.out.long_mirror,hltsModel.in.long_bot_drive,:))); % [m/N]
hltsModel.midldrive2botm.long = ...
    abs(squeeze(hltsModel.HLTS_freqresp(hltsModel.out.long_mirror,hltsModel.in.long_mid_drive,:))); % [m/N]

hlts.cage2botm.long = interp1(hltsModel.freq,hltsModel.cage2botm.long,freq);
hlts.botmdrive2botm.long = interp1(hltsModel.freq,hltsModel.botmdrive2botm.long,freq);
hlts.midldrive2botm.long = interp1(hltsModel.freq,hltsModel.midldrive2botm.long,freq);
     
%% Numbers from T020059
mcClaim.mass     =  3.5;   % [kg]
pr3Claim.mass    = 10.0;   % [kg]

mcClaim.Fmax(3)  = 1e-6;   % [N] (max) [REF ??]
mcClaim.Fmax(2)  = 2.00;   % [N] (max)

pr3Claim.Fmax(2) = 80;     % [N] (max)

iOSEM.forceGrad  = 100;    % [1/m] [REF ??]

hamClaim.logreqs = [1e-11 2e-13 5e-15]; % [m/rtHz] [Old BSC ISI Reqs]
hamClaim.logfreq = [1     10    100  ]; % [Hz]

mcClaim.logReqs  = [3e-17 3e-19];       % [m/rtHz] [REF ??]
mcClaim.logFreq  = [10    100  ];

pr3Claim.logReqs = [4e-16 1.5e-17];     % [m/rtHz] [REF ??]
pr3Claim.logFreq = [10    100    ];

hamClaim.logintp = interp1(log10(hamClaim.logfreq),log10(hamClaim.logreqs),...
                           log10(freq));
mcClaim.logintp  = interp1(log10(mcClaim.logFreq),log10(mcClaim.logReqs),...
                           log10(freq));
pr3Claim.logintp = interp1(log10(pr3Claim.logFreq),log10(pr3Claim.logReqs),...
                           log10(freq));
                       
hamClaim.reqs = 10.^hamClaim.logintp;
mcClaim.reqs  = 10.^mcClaim.logintp;
pr3Claim.reqs = 10.^pr3Claim.logintp;

%% Calcs from T020059
% HSTS
mcClaim.reqs_F                      = (mcClaim.mass.* w.^2) .* mcClaim.reqs;           % Eq (1), T020059
mcClaim.reqs_x                      = mcClaim.reqs;
 
mcClaim.coilNoise_F.isiclaim2midl   = mcClaim.Fmax(2) .* iOSEM.forceGrad ...         % Eq (3), T020059
                                      .* hamClaim.reqs .* (1./freq).^2; 
mcClaim.coilNoise_x.isiclaim2midl   = mcClaim.coilNoise_F.isiclaim2midl ...
                                      ./ (mcClaim.mass .* w.^2);

                                  
mcClaim.coilNoise_F.isiclaim2botm   = mcClaim.Fmax(3) .* iOSEM.forceGrad ...         % Eq (2), T020059
                                      .* hamClaim.reqs;
mcClaim.coilNoise_x.isiclaim2botm   = mcClaim.coilNoise_F.isiclaim2botm ...
                                      ./ (mcClaim.mass .* w.^2);
                                  
mcClaim.groundNoise_x.isiclaim2botm = hamClaim.reqs .* hsts.cage2botm.long;

% HLTS
pr3Claim.reqs_F                     = pr3Claim.mass .* w.^2 .* pr3Claim.reqs;        % Eq (1), T020059
pr3Claim.reqs_x                     = pr3Claim.reqs;

% prmClaim.coilNoise.isiclaim2botm = T020059 claims that there is no control at optic

pr3Claim.coilNoise_F.isiclaim2midl  = pr3Claim.Fmax(2) .* iOSEM.forceGrad ...        % Eq (3), T020059
                                      .* hamClaim.reqs .*(1./freq).^2;
pr3Claim.coilNoise_x.isiclaim2midl  = pr3Claim.coilNoise_F.isiclaim2midl ...
                                      ./ (pr3Claim.mass .* w.^2);

pr3Claim.groundNoise_x.isiclaim2botm = hamClaim.reqs .* hlts.cage2botm.long;                                     
                                  
%% Update the EVERYTHING (a.k.a ALL of the THINGS)
mc.mass       = 2.892;  % [kg]  [T0900435]
pr3.mass      = 12.14;  % [kg]  [T1000012]

hsts.f0    = 2.829; % [Hz] Middle to Bottom Stage Resonant Frequency, T080311
hlts.f0    = 2.899; % [Hz] Middle to Bottom Stage Resonant Frequency, T080310

nDataPoints = length(freq);
thirtyHzInd = find(freq < 30,1,'last');

hsts.reqs_upto30Hz  = 3e-17 .* (10 ./ freq(1:thirtyHzInd)).^(5/2); % [m/rtHz] [Table 3, T010007]
hsts.reqs_x         = [hsts.reqs_upto30Hz' ...                     % [m/rtHz] [T080192]
                       hsts.reqs_upto30Hz(thirtyHzInd)*ones(1,nDataPoints-thirtyHzInd)]; 
hsts.reqs_x         = hsts.reqs_x';             
                   
hlts.reqs_upto30Hz  = 3e-17 .* (10 ./ freq(1:thirtyHzInd)).^(5/2); % [m/rtHz] [Table 3, T010007]
hlts.reqs_x         = [hlts.reqs_upto30Hz' ...                     % [m/rtHz T080192]
                       hlts.reqs_upto30Hz(thirtyHzInd)*ones(1,nDataPoints-thirtyHzInd)];
hlts.reqs_x         = hlts.reqs_x';                     
                   
                   
% Longitudinal Direction Only!
% According to Table 1 in M0900034:
% Top Masses have BOSEMs, with 10 mm Diam x 5 mm Length NdFeB
% Middle Masses have LIGO 1 OSEMS, with 0.075" Diam x 0.125" Length SmCo Magnets (Same as T020059)
% Bottom Masses have LIGO 1 OSEMS, with 2.0 mm Diam x 0.5 mm Length SmCo Magnets (Thinner)
%                  |Top   |Middle  |Bottom
hsts.nOsems      = [ 2    ;  4     ;  4      ];         % []      [Table 1, pg 12 T0900435]
hsts.magReqs     = [60.000;  3.0000;  0.15000] .* 1e-3; % [A] pk  [Table 1, pg 12 T0900435]
hsts.actStrength = [ 0.963;  0.0158;  0.00281];         % [N/A]   ["fmax", Tbl 2 & 3, T1000164]
hsts.magCouplng  = [87.600;  1.6100;  0.28800];         % [N/A/m] ["coupling", Tbl 2 & 3, T1000164]

hsts.Fmax        = hsts.nOsems.*hsts.actStrength.*hsts.magReqs; % N
hsts.forceGrad   = hsts.magCouplng ./ hsts.actStrength;         % 1/m

% Top Masses have BOSEMs, with 10 mm Diam x 10 mm Length NdFeB
% Middle Masses have LIGO 1 OSEMS, with 0.075" Diam x 0.125" Length SmCo Magnets (Same as T020059)
% Bottom Masses have LIGO 1 OSEMS, with 2.0 mm Diam x 0.5 mm Length SmCo
% Magnets (Thinner)
hlts.nOsems      = [ 2    ;  4     ;  4      ];         % []      [Table 1, pg 12 T1000012]
hlts.magReqs     = [60.000;  3.0000;  0.15000] .* 1e-3; % Amp pk  [Table 1, pg 12 T1000012]
hlts.actStrength = [ 1.694;  0.0158;  0.00281];         % [N/A]   ["fmax", Table 2 & 3, T1000164]
hlts.magCouplng  = [87.600;  1.6100;  0.28800];         % [N/A/m] ["coupling", Tbl 2 & 3, T1000164]

hlts.Fmax        = hlts.nOsems.*hlts.actStrength.*hlts.magReqs; % N
hlts.forceGrad   = hlts.magCouplng ./ hlts.actStrength;         % 1/m

ham.meas = asds.tbl.y;
[ham.prclreq,ham.srclreq_h,ham.srclreq.v] = HAM_req(freq);


%% Redo calcs
% HSTS (Was MC)                    
hsts.coilNoise_x.isimeas2midl   = hsts.Fmax(2) .* hsts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.meas .* hsts.midldrive2botm.long;
hsts.coilNoise_x.isiprcl2midl   = hsts.Fmax(2) .* hsts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.prclreq .* hsts.midldrive2botm.long;
hsts.coilNoise_x.isisrcl2midl   = hsts.Fmax(2) .* hsts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.srclreq_h .* hsts.midldrive2botm.long;
                             
hsts.coilNoise_x.isimeas2botm   = hsts.Fmax(3) .* hsts.forceGrad(3) ...         % Equivalent to Eq (2), T020059
                                  .* ham.meas .* hsts.botmdrive2botm.long;      
hsts.coilNoise_x.isiprcl2botm   = hsts.Fmax(3) .* hsts.forceGrad(3) ...         % Equivalent to Eq (2), T020059
                                  .* ham.prclreq .* hsts.botmdrive2botm.long;
hsts.coilNoise_x.isisrcl2botm   = hsts.Fmax(3) .* hsts.forceGrad(3) ...         % Equivalent to Eq (2), T020059
                                  .* ham.srclreq_h .* hsts.botmdrive2botm.long;

hsts.groundNoise_x.isimeas2botm = ham.meas .* hsts.cage2botm.long;
hsts.groundNoise_x.isiprcl2botm = ham.prclreq .* hsts.cage2botm.long;
hsts.groundNoise_x.isisrcl2botm = ham.srclreq_h .* hsts.cage2botm.long;

% HLTS (Was PR3)                      

hlts.coilNoise_x.isimeas2midl   = hlts.Fmax(2) .* hlts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.meas .* hlts.midldrive2botm.long;
hlts.coilNoise_x.isiprcl2midl   = hlts.Fmax(2) .* hlts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.prclreq .* hlts.midldrive2botm.long;
hlts.coilNoise_x.isisrcl2midl   = hlts.Fmax(2) .* hlts.forceGrad(2) ...         % Equivalent to Eq (3), T020059
                                  .* ham.srclreq_h .* hlts.midldrive2botm.long;

hlts.coilNoise_x.isimeas2botm   = hlts.Fmax(3) .* hlts.forceGrad(3) ...
                                  .* ham.meas .* hlts.botmdrive2botm.long;      % Equivalent to Eq (2), T020059
hlts.coilNoise_x.isiprcl2botm   = hlts.Fmax(3) .* hlts.forceGrad(3) ...
                                  .* ham.prclreq .* hlts.botmdrive2botm.long;   % Equivalent to Eq (2), T020059
hlts.coilNoise_x.isisrcl2botm   = hlts.Fmax(3) .* hlts.forceGrad(3) ...
                                  .* ham.srclreq_h .* hlts.botmdrive2botm.long; % Equivalent to Eq (2), T020059

hlts.groundNoise_x.isimeas2botm = ham.meas .* hlts.cage2botm.long;
hlts.groundNoise_x.isiprcl2botm = ham.prclreq .* hlts.cage2botm.long;
hlts.groundNoise_x.isisrcl2botm = ham.srclreq_h .* hlts.cage2botm.long;

%% Convert Displacement Noise to Force Noise
% HSTS
hsts.reqs_F                     = (mc.mass .* w.^2) .* hsts.reqs_x;

hsts.coilNoise_F.isimeas2midl   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isimeas2midl;
hsts.coilNoise_F.isiprcl2midl   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isiprcl2midl;
hsts.coilNoise_F.isisrcl2midl   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isisrcl2midl;
                              
hsts.coilNoise_F.isimeas2botm   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isimeas2botm;
hsts.coilNoise_F.isiprcl2botm   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isiprcl2botm;
hsts.coilNoise_F.isisrcl2botm   = (mc.mass .* w.^2) .* hsts.coilNoise_x.isisrcl2botm;

hsts.groundNoise_F.isimeas2botm = (mc.mass .* w.^2) .* hsts.groundNoise_x.isimeas2botm;
hsts.groundNoise_F.isiprcl2botm = (mc.mass .* w.^2) .* hsts.groundNoise_x.isiprcl2botm;
hsts.groundNoise_F.isisrcl2botm = (mc.mass .* w.^2) .* hsts.groundNoise_x.isisrcl2botm;

% HLTS
hlts.reqs_F                     = (pr3.mass .* w.^2) .* hlts.reqs_x;

hlts.coilNoise_F.isimeas2midl   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isimeas2midl;
hlts.coilNoise_F.isiprcl2midl   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isiprcl2midl;
hlts.coilNoise_F.isisrcl2midl   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isisrcl2midl;

hlts.coilNoise_F.isimeas2botm   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isimeas2botm;
hlts.coilNoise_F.isiprcl2botm   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isiprcl2botm;
hlts.coilNoise_F.isisrcl2botm   = (pr3.mass .* w.^2) .* hlts.coilNoise_x.isisrcl2botm;

hlts.groundNoise_F.isimeas2botm = (pr3.mass .* w.^2) .* hlts.groundNoise_x.isimeas2botm;
hlts.groundNoise_F.isiprcl2botm = (pr3.mass .* w.^2) .* hlts.groundNoise_x.isiprcl2botm;
hlts.groundNoise_F.isisrcl2botm = (pr3.mass .* w.^2) .* hlts.groundNoise_x.isisrcl2botm;

%% HAM ISI Model Displacement Figures
figure(1)
ll = loglog(freq,hamClaim.reqs,...
            freq,ham.meas,...
            freq,ham.prclreq,...
            freq,ham.srclreq_h);
title({'HAM Optical Table Displacement';'Y Direction'})
legend('T020059 Claim (Old BSC Reqs)',...
       'L1 HAM6 ISI, March 23 2010',...
       'aLIGO PRCL ISI Reqs (H)',...
       'aLIGO SRCL ISI Reqs (H)',...    
       'Location','SouthWest');
ylabel('Displacement (m/rtHz)')
xlabel('Frequency (Hz)')
set(gca,'YTick',10.^(-15:-6))
ylim([1e-15 1e-6])
xlim(freqRange)
for iColor = 1:length(colorTable);
   set(ll(iColor),'Color',colorTable(iColor,:));
end

%% SUS Model Figures
figure(2)
ll = loglog(freq,hsts.cage2botm.long,...
            freq,hlts.cage2botm.long);
title({'Longitudal Transfer Functions';'Cage to Bottom, Through Triple SUS'})
set(gca,'YTick',10.^(-10:2))
set(ll,'LineWidth',3)
ylabel('Magnitude (m/m)')
xlabel('Frequency (Hz)')
legend('HSTS','HLTS')
xlim(freqRange)
ylim([1e-10 100])

figure(3)
ll = loglog(freq,hsts.botmdrive2botm.long,...
            freq,hlts.botmdrive2botm.long,...
            freq,hsts.midldrive2botm.long,...
            freq,hlts.midldrive2botm.long,...
            freq,(1./(mc.mass.*w.^2)),...
            freq,(1./(pr3.mass.*w.^2)));
title({'Longitudal Transfer Functions';'Drive to Bottom Response'})
set(gca,'YTick',10.^(-10:0))
set(ll,'LineWidth',2)
ylabel('Magnitude (m/N)')
xlabel('Frequency (Hz)')
legend('HSTS Bottom 2 Bottom','HLTS Bottom 2 Bottom',...
       'HSTS Middle 2 Bottom','HLTS Middle 2 Bottom',...
       '1/(m\_MC2 * w^2)','1/(m\_PR3 * w^2)',...
       'Location','SouthWest')
set(ll(1:2),'LineWidth',4,'LineStyle','-')
set(ll(3:4),'LineWidth',3,'LineStyle','-.')
set(ll(5:6),'LineWidth',2,'LineStyle','--')
set(ll([1 3]),'Color',[0.0 0.0 1.0])
set(ll([2 4]),'Color',[0.0 0.5 0.0])
set(ll(5),'Color',[0.5 0.5 1.0])
set(ll(6),'Color',[0.0 1.0 0.0])
xlim(freqRange)
ylim([1e-10 1])   


%% HSTS Figures
figure(4);
ll = loglog(freq,[mcClaim.reqs_x ...
                  hsts.reqs_x ...
                  mcClaim.coilNoise_x.isiclaim2botm ...
                  mcClaim.coilNoise_x.isiclaim2midl ...
                  mcClaim.groundNoise_x.isiclaim2botm ...
                  hsts.coilNoise_x.isimeas2botm ...
                  hsts.coilNoise_x.isimeas2midl ...
                  hsts.groundNoise_x.isimeas2botm]);
title({'HAM Small Triple OSEM Control Noise';'T020059 vs. Updates with eLIGO ISI Input'})
leg = legend(['T020059 MC Reqs (' num2str(mcClaim.mass,3) ' kg)'],...
             ['Updated HSTS Reqs (T010007-v2, ' num2str(mc.mass,3) ' kg)'],...
             'T020059 Direct Control of Bottom',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (eLIGO ISI)',...
             'Updated Middle Control to Bottom (eLIGO ISI)',...
             'Updated Trans. Thru SUS to Bottom (eLIGO ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[0.2 0.2 0.2])
set(ll(7),'Color',[0.2 0.2 0.2])
set(ll(8),'Color',[0.2 0.2 0.2])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)

figure(5);
ll = loglog(freq,[mcClaim.reqs_x ...
                  hsts.reqs_x ...
                  mcClaim.coilNoise_x.isiclaim2botm ...
                  mcClaim.coilNoise_x.isiclaim2midl ...
                  mcClaim.groundNoise_x.isiclaim2botm ...
                  hsts.coilNoise_x.isiprcl2botm ...
                  hsts.coilNoise_x.isiprcl2midl ...
                  hsts.groundNoise_x.isiprcl2botm]);
title({'HAM Small Triple OSEM Control Noise';'T020059 vs. Updates with PRCL ISI Reqs. Input'})
leg = legend(['T020059 MC Reqs (' num2str(mcClaim.mass,3) ' kg)'],...
             ['Updated HSTS Reqs (T010007-v2, ' num2str(mc.mass,3) ' kg)'],...
             'T020059 Direct Control of Bottom',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (PRCL ISI)',...
             'Updated Middle Control to Bottom (PRCL ISI)',...
             'Updated Trans. Thru SUS to Bottom (PRCL ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[1.0 0.4 0.0])
set(ll(7),'Color',[1.0 0.4 0.0])
set(ll(8),'Color',[1.0 0.4 0.0])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)


figure(6);
ll = loglog(freq,[mcClaim.reqs_x ...
                  hsts.reqs_x ...
                  mcClaim.coilNoise_x.isiclaim2botm ...
                  mcClaim.coilNoise_x.isiclaim2midl ...
                  mcClaim.groundNoise_x.isiclaim2botm ...
                  hsts.coilNoise_x.isisrcl2botm ...
                  hsts.coilNoise_x.isisrcl2midl ...
                  hsts.groundNoise_x.isisrcl2botm]);
title({'HAM Small Triple OSEM Control Noise';'T020059 vs. Updates with SRCL ISI Reqs. Input'})
leg = legend(['T020059 MC Reqs (' num2str(mcClaim.mass,3) ' kg)'],...
             ['Updated HSTS Reqs (T010007-v2, ' num2str(mc.mass,3) ' kg)'],...
             'T020059 Direct Control of Bottom',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (SRCL ISI)',...
             'Updated Middle Control to Bottom (SRCL ISI)',...
             'Updated Trans. Thru SUS to Bottom (SRCL ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[1.0 0.7 0.0])
set(ll(7),'Color',[1.0 0.7 0.0])
set(ll(8),'Color',[1.0 0.7 0.0])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)
%% HLTS Figures
figure(7);
ll = loglog(freq,[pr3Claim.reqs_x ...
                  hlts.reqs_x ...
                  zeros(length(freq),1) ...
                  pr3Claim.coilNoise_x.isiclaim2midl ...
                  pr3Claim.groundNoise_x.isiclaim2botm ...
                  hlts.coilNoise_x.isimeas2botm ...
                  hlts.coilNoise_x.isimeas2midl ...
                  hlts.groundNoise_x.isimeas2botm]);
title({'HAM Large Triple OSEM Control Noise';'T020059 vs. Updates with eLIGO ISI Input'})
leg = legend(['T020059 PR3 Reqs (' num2str(pr3Claim.mass,3) ' kg)'],...
             ['Updated HLTS Reqs (T010007-v2, ' num2str(pr3.mass,3) ' kg)'],...
             'T020059 Had Assumed No Bottom Control',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (eLIGO ISI)',...
             'Updated Middle Control to Bottom (eLIGO ISI)',...
             'Updated Trans. Thru SUS to Bottom (eLIGO ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[0.2 0.2 0.2])
set(ll(7),'Color',[0.2 0.2 0.2])
set(ll(8),'Color',[0.2 0.2 0.2])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)

figure(8);
ll = loglog(freq,[pr3Claim.reqs_x ...
                  hlts.reqs_x ...
                  zeros(length(freq),1) ...
                  pr3Claim.coilNoise_x.isiclaim2midl ...
                  pr3Claim.groundNoise_x.isiclaim2botm ...
                  hlts.coilNoise_x.isiprcl2botm ...
                  hlts.coilNoise_x.isiprcl2midl ...
                  hlts.groundNoise_x.isiprcl2botm]);
title({'HAM Large Triple OSEM Control Noise';'T020059 vs. Updates with PRCL ISI Reqs. Input'})
leg = legend(['T020059 PR3 Reqs (' num2str(pr3Claim.mass,3) ' kg)'],...
             ['Updated HLTS Reqs (T010007-v2, ' num2str(pr3.mass,3) ' kg)'],...
             'T020059 Had Assumed No Bottom Control',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (PRCL ISI)',...
             'Updated Middle Control to Bottom (PRCL ISI)',...
             'Updated Trans. Thru SUS to Bottom (PRCL ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[1.0 0.4 0.0])
set(ll(7),'Color',[1.0 0.4 0.0])
set(ll(8),'Color',[1.0 0.4 0.0])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)


figure(9);
ll = loglog(freq,[pr3Claim.reqs_x ...
                  hlts.reqs_x ...
                  zeros(length(freq),1) ...
                  pr3Claim.coilNoise_x.isiclaim2midl ...
                  pr3Claim.groundNoise_x.isiclaim2botm ...
                  hlts.coilNoise_x.isisrcl2botm ...
                  hlts.coilNoise_x.isisrcl2midl ...
                  hlts.groundNoise_x.isisrcl2botm]);
title({'HAM Large Triple OSEM Control Noise';'T020059 vs. Updates with SRCL ISI Reqs. Input'})
leg = legend(['T020059 PR3 Reqs (' num2str(pr3Claim.mass,3) ' kg)'],...
             ['Updated HLTS Reqs (T010007-v2, ' num2str(pr3.mass,3) ' kg)'],...
             'T020059 Had Assumed No Bottom Control',...
             'T020059 Middle Control to Bottom',...
             'T020059 Trans. Thru SUS to Bottom',...
             'Updated Direct Control of Bottom (SRCL ISI)',...
             'Updated Middle Control to Bottom (SRCL ISI)',...
             'Updated Trans. Thru SUS to Bottom (SRCL ISI)',...
             'Location','SouthWest');
set(leg,'FontSize',12);        
ylabel('Displacement Noise (m/rtHz)')              
xlabel('Frequency (Hz)')
set(gca,'YTick',dispTicks)
set(ll(1),'Color',[1.0 0.5 0.5])
set(ll(2),'Color',[1.0 0.0 0.0])
set(ll(3),'Color',[0.0 0.0 1.0])
set(ll(4),'Color',[0.0 0.0 1.0])
set(ll(5),'Color',[0.0 0.0 1.0])
set(ll(6),'Color',[1.0 0.7 0.0])
set(ll(7),'Color',[1.0 0.7 0.0])
set(ll(8),'Color',[1.0 0.7 0.0])
set(ll([1 2]),'LineWidth',5,'LineStyle','--')
set(ll([5 8]),'LineWidth',4,'LineStyle','-')
set(ll([4 7]),'LineWidth',3,'LineStyle','-.')
set(ll([3 6]),'LineWidth',4,'LineStyle',':')
xlim(freqRange)
ylim(dispRange)
%%
if printFigs
    figure(1)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HAMISIDisplacement.pdf')
    
    figure(2)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_TripleTransmission.pdf')
    
    figure(3)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_TripleForceTFs.pdf')
    
    figure(4)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HSTSComparison_eLIGOISI.pdf')
    
    figure(5)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HSTSComparison_PRCLISI.pdf')
    
    figure(6)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HSTSComparison_SRCLISI.pdf')    
    
    figure(7)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HLTSComparison_eLIGOISI.pdf')
    
    figure(8)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HLTSComparison_PRCLISI.pdf')
    
    figure(9)
    FillPage('w')
    IDfig(authorId)
    saveas(gcf,'redoT020059_HLTSComparison_SRCLISI.pdf')
end

