%% Track spectral weight across the transition

set(0,'defaulttextInterpreter','latex')
set(groot, 'defaultAxesTickLabelInterpreter','latex'); set(groot, 'defaultLegendInterpreter','latex');

format long

font          = 'Bahnschrift';

% Load data
Data                       = load('C:/Users/Karthik/Documents/GitRepositories/Calculations/Data-Analyzer/StructuralPhaseTransition/SpectralAnalysisRoutines/Max_g2_DropletsToStripes.mat', 'unique_scan_parameter_values', 'mean_max_g2_values', 'std_error_g2_values');

dts_scan_parameter_values  = Data.unique_scan_parameter_values;
dts_mean_mg2               = Data.mean_max_g2_values;
dts_stderr_mg2             = Data.std_error_g2_values;

Data                       = load('C:/Users/Karthik/Documents/GitRepositories/Calculations/Data-Analyzer/StructuralPhaseTransition/SpectralAnalysisRoutines/Max_g2_StripesToDroplets.mat', 'unique_scan_parameter_values', 'mean_max_g2_values', 'std_error_g2_values');

std_scan_parameter_values  = Data.unique_scan_parameter_values;
std_mean_mg2               = Data.mean_max_g2_values;
std_stderr_mg2             = Data.std_error_g2_values;

figure(1);
set(gcf,'Position',[100 100 950 750])
errorbar(dts_scan_parameter_values, dts_mean_mg2, dts_stderr_mg2, 'o--', ...
    'LineWidth', 1.5, 'MarkerSize', 6, 'CapSize', 5, 'DisplayName' , 'Droplets to Stripes');
hold on
errorbar(std_scan_parameter_values, std_mean_mg2, std_stderr_mg2, 'o--', ...
    'LineWidth', 1.5, 'MarkerSize', 6, 'CapSize', 5, 'DisplayName', 'Stripes to Droplets');
set(gca, 'FontSize', 14, 'YLim', [0, 1]);
hXLabel = xlabel('$\alpha$ (degrees)', 'Interpreter', 'latex');
hYLabel = ylabel('$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', 'Interpreter', 'latex');
% hTitle = title('B = 2.42 G', 'Interpreter', 'tex');
legend
set([hXLabel, hYLabel], 'FontName', font)
set([hXLabel, hYLabel], 'FontSize', 14)
% set(hTitle, 'FontName', font, 'FontSize', 16, 'FontWeight', 'bold');  % Set font and size for title
grid on
%%