%  Measurements each one after dis and the reconnecting the BNC cable at
% the 3458A over the period of several days

 run = [2:18, 21:24];
 
for i= 1:length(run)
GI(i) = Load_gap_int_plt(run(i));
Temp(i) = Load_tstpar_flex_coil(run(i));
end

day = ['09-06-2019  13:29:59';
       '09-06-2019  13:42:52';
       '09-06-2019  13:54:44';
       '09-06-2019  14:09:35';
       '09-06-2019  14:24:45';
       '09-09-2019  10:06:48';
       '09-09-2019  10:34:31';
       '09-09-2019  10:45:58';
       '09-11-2019  11:00:21';
       '09-11-2019  11:31:32';   
       '09-11-2019  11:44:13';   
       '09-12-2019  13:34:59';
       '09-13-2019  08:26:42';   
       '09-13-2019  11:52:57';
       '09-14-2019  09:29:48';   
       '09-14-2019  11:31:18';
       '09-14-2019  15:48:02';  
       '09-16-2019  15:12:03';   %      '09-16-2019  10:55:22';  run 20 removed
       '09-16-2019  17:24:12';   
       '09-19-2019  11:27:56'; 
       '09-19-2019  11:39:29'];
   
  

   
% Plus Data   
Integral_plus_mean = [GI.Gap_Corr_Integral_plus_mean];
Integral_plus_std = [GI.Gap_Corr_Integral_plus_std];

% Minus Data   
Integral_minus_mean = [GI.Gap_Corr_Integral_minus_mean];
Integral_minus_std = [GI.Gap_Corr_Integral_minus_std];

% Temperature Data
Module_Temp_mean = mean([Temp.Module_mean]);
Arm_Jaw_Diff_mean = mean([Temp.Arm_Jaw_diff]);


% Make hour offset vector from run 2
size_day = size(day);
num_meas = size_day(1);

for i = 1:num_meas
    hour_offset(i) = (datenum(day(i,:)) - datenum(day(1,:)))*24;
end

% Plus Data Plot 
[data_mean_plus,data_std_plus] = plot_bars_with_mean_std(hour_offset,Integral_plus_mean,Integral_minus_std,'Time','(Hr)','Plus Integral','(Vs)');

% Minus Data Plot
[data_mean_minus,data_std_minus] = plot_bars_with_mean_std(hour_offset,Integral_minus_mean,Integral_minus_std,'Time','(Hr)','Minus Integral','(Vs)');

figure('units','normalized','outerposition',[0 0 1 1])  
plot(hour_offset, Module_Temp_mean -  Module_Temp_mean(1), marker_make3(4));
hold
plot(hour_offset, Arm_Jaw_Diff_mean, marker_make3(2));
xlabel('Time (Hours)');
ylabel('Carrier Temperature (C)');
title('Undulator Carrier Temperature vs Time'); 
legend('Module Temp Diff', 'Arm-Jaw Temp')