%   Gap integral sensitivity.  This script analyzes the gap sensitivity of
%   the 1 meter undulator.  

% with gap change of 2.001 mm
Plot_Test_Coil(41, 0.002001);

% with gap change of 2.002 mm
Plot_Test_Coil(42, 0.002002);

% with gap change of 2.000 mm
Plot_Test_Coil(43, 0.002);

close all

Int_Change_1_micron_2_nom = GI_run41.norm_mean/GI_run43.norm_mean;

Int_Change_2_micron_2_nom = GI_run42.norm_mean/GI_run43.norm_mean;

mean_gap_change_1_micron = mean(abs(GI_run41.Gap_Change));

mean_gap_change_2_micron = mean(abs(GI_run42.Gap_Change));

mean_gap_change_nominal= mean(abs(GI_run43.Gap_Change));

ratio_move_1_micron_nom =  mean_gap_change_1_micron/mean_gap_change_nominal;
 
 ratio_move_2_micron_nom = mean_gap_change_2_micron/mean_gap_change_nominal;
 