% Process_Test_Coil
% 
% 
% Input: Runs are the run numbers to be summerized. 



   Gap_Int22 = Load_gap_int_plt(22);
   Temp22 =  Load_tstpar_small_coil(22);
    
% Temperature normalization multiplier
Temp_norm = (([Temp22.Jaw] - [Temp22.Jaw(1)])*-0.0011)+1;
% Correcting for the different temperatures at the different integal measurements

c=1;
for i=1:2:length(GI_run22.Gap_Integral)
    GI_run22_Integral_Temp_Corr(i) =  abs(GI_run22.Gap_Integral(i)*Temp_norm(c));
    GI_run22_Integral_Temp_Corr(i+1) =  abs(GI_run22.Gap_Integral(i+1)*Temp_norm(c)); 
        c = c+1;
end

figure
plot_with_mean_std(GI_run22.Time/60, abs(GI_run22.Gap_Integral),'Time','(Hours)','Intgrated Voltage','(V)')
title('Test Flex Board Gap Integral Summary'); 
text(3, 0.05685,['2*STD/Mean = ', num2str(GI_run22.norm_error_no_flyer)]);

figure
plot(GI_run22.Time/60, GI_run22_Integral_Temp_Corr, 'bo');
hline(mean(GI_run22_Integral_Temp_Corr),'r', 'mean');
hline(mean(GI_run22_Integral_Temp_Corr) + mean(GI_run22_Integral_Temp_Corr)*0.0003 ,'r--', 'mean + mean*0.0003');
hline(mean(GI_run22_Integral_Temp_Corr) - mean(GI_run22_Integral_Temp_Corr)*0.0003,'r--','mean - mean*0.0003');
xlabel({'Time','(Hours)'});
ylabel({'Intgrated Voltage','(V)'})








% Run_Summary_mean = mean([Gap_Int.norm_mean]);
% Run_Summary_std = std([Gap_Int.norm_mean]);
% 
% % Output GI structure with run number to workspace
%       assignin('base', 'Gap_Int', Gap_Int);
%        assignin('base', 'Temp', Temp);
% 

