Latest fully functional version - Major bugfixes.

This commit is contained in:
Karthik 2025-09-09 18:08:34 +02:00
parent 5fd39e31f4
commit a7c0be507c
17 changed files with 274 additions and 281 deletions

View File

@ -1,68 +1,60 @@
function results = extractAutocorrelation(theta_values, angular_spectral_distribution, scan_parameter_values, N_shots, N_angular_bins)
%% Extract g² (autocorrelation) from experimental images
% Computes angular autocorrelation g² for a set of experimental images.
% Returns both all repetition curves and their mean + error for each scan parameter.
%% Extract g² (autocorrelation)
% Computes angular autocorrelation g² for a set of angular spectral distribution.
% Returns all g2 curves grouped by unique scan parameter, mean, error
% ===== Convert spectral distributions to matrix =====
delta_nkr_all = zeros(N_shots, N_angular_bins);
for k = 1:N_shots
delta_nkr_all(k, :) = angular_spectral_distribution{k};
end
% ===== Convert spectral distributions to matrix =====
delta_nkr_all = zeros(N_shots, N_angular_bins);
for k = 1:N_shots
delta_nkr_all(k, :) = angular_spectral_distribution{k};
end
% ===== Determine unique scan parameter values =====
if isnumeric(scan_parameter_values) && isvector(scan_parameter_values)
% --- Single parameter case (numeric vector) ---
[unique_scan_parameter_values, ~, idx] = unique(scan_parameter_values(:), 'stable');
N_params = numel(scan_parameter_values);
elseif iscell(scan_parameter_values)
% --- Multi-parameter case (cell array of row vectors) ---
params = cell2mat(scan_parameter_values); % convert to numeric matrix
[unique_scan_parameter_values, ~, idx] = unique(params, 'rows', 'stable');
N_params = numel(scan_parameter_values);
else
error('Unsupported format for raw scan parameter values.');
% ===== Determine unique scan parameter values =====
if isnumeric(scan_parameter_values) && isvector(scan_parameter_values)
% Single parameter case
[unique_scan_parameter_values, ~, idx] = unique(scan_parameter_values(:), 'stable');
elseif iscell(scan_parameter_values)
% Multi-parameter case (each row is a parameter set)
params = cell2mat(scan_parameter_values);
[unique_scan_parameter_values, ~, idx] = unique(params, 'rows', 'stable');
else
error('Unsupported format for scan_parameter_values.');
end
N_unique = size(unique_scan_parameter_values, 1);
% ===== Preallocate outputs =====
g2_curves = cell(1, N_unique); % each cell: [N_reps × N_angular_bins]
% ===== Compute g²(θ) for each unique scan parameter =====
for i = 1:N_unique
group_idx = find(idx == i); % indices of repetitions for this unique value
group_data = delta_nkr_all(group_idx, :);
N_reps = length(group_idx);
g2_matrix = zeros(N_reps, N_angular_bins);
for j = 1:N_reps
profile = group_data(j, :);
for dtheta = 0:N_angular_bins-1
profile_shifted = circshift(profile, -dtheta, 2);
g2_matrix(j, dtheta+1) = mean(profile .* profile_shifted) / mean(profile.^2);
end
end
% ===== Preallocate outputs =====
g2_curves = cell(1, N_params); % each cell: [N_reps × N_angular_bins]
g2_mean = zeros(N_params, N_angular_bins);
g2_error = zeros(N_params, N_angular_bins);
% Store all repetitions for this unique scan parameter
g2_curves{i} = g2_matrix;
end
% ===== Compute g²(θ) for each scan parameter group =====
for i = 1:N_params
group_idx = find(idx == i);
group_data = delta_nkr_all(group_idx, :);
N_reps = length(group_idx);
% ===== Compute mean and SEM per unique value =====
g2_mean = cellfun(@(G) mean(G, 1, 'omitnan'), g2_curves, 'UniformOutput', false);
g2_error = cellfun(@(G) std(G, 0, 1, 'omitnan') ./ sqrt(size(G,1)), g2_curves, 'UniformOutput', false);
g2_matrix = zeros(N_reps, N_angular_bins);
for j = 1:N_reps
profile = group_data(j, :);
for dtheta = 0:N_angular_bins-1
profile_shifted = circshift(profile, -dtheta, 2);
num = mean(profile .* profile_shifted);
denom = mean(profile.^2);
g2_matrix(j, dtheta+1) = num / denom;
end
end
% Store per-repetition curves
g2_curves{i} = g2_matrix;
% Compute mean and standard error
g2_mean(i,:) = mean(g2_matrix, 1, 'omitnan');
g2_error(i,:) = std(g2_matrix, 0, 1, 'omitnan') ./ sqrt(N_reps);
end
% ===== Package results =====
results = struct();
results.g2_curves = g2_curves; % raw [N_reps × N_angular_bins] per group
results.g2_mean = g2_mean; % mean per group
results.g2_error = g2_error; % standard error per group
results.theta_values = theta_values;
results.scan_parameter_values = unique_scan_parameter_values;
end
% ===== Package results =====
results = struct();
results.g2_curves = g2_curves; % raw [N_reps × N_angular_bins] per unique group
results.g2_mean = g2_mean; % mean per unique group
results.g2_error = g2_error; % SEM per unique group
results.theta_values = theta_values;
results.scan_parameter_values = unique_scan_parameter_values;
end

View File

@ -1,118 +1,101 @@
function results = extractCustomCorrelation(angular_spectral_distribution, scan_parameter_values, N_shots, N_angular_bins)
%% Extracts correlation of a single (highest) peak with possible secondary peak (50-70°)
%
% Inputs:
% od_imgs - Cell array of images
% scan_parameter_values - Vector of scan parameters corresponding to images
% pixel_size - Camera pixel size in meters
% magnification - Imaging magnification
% zoom_size - Half-size of FFT crop around center
% r_min, r_max - Radial bounds for angular spectral distribution
% N_angular_bins - Number of angular bins
% Angular_Threshold, Angular_Sigma - Parameters for angular weighting
% skipPreprocessing, skipMasking, skipIntensityThresholding, skipBinarization - flags for FFT preprocessing
%
% Output:
% results - Struct containing g2 correlation and cumulant statistics per scan parameter
% Computes correlations and cumulants grouped by unique scan parameter.
% ===== Convert spectral distributions to matrix (N_shots x N_angular_bins) =====
delta_nkr_all = zeros(N_shots, N_angular_bins);
for k = 1:N_shots
delta_nkr_all(k, :) = angular_spectral_distribution{k};
end
% ===== Convert spectral distributions to matrix =====
delta_nkr_all = zeros(N_shots, N_angular_bins);
for k = 1:N_shots
delta_nkr_all(k, :) = angular_spectral_distribution{k};
end
% ===== Determine unique scan parameter values =====
if isnumeric(scan_parameter_values) && isvector(scan_parameter_values)
% --- Single parameter case (numeric vector) ---
[~, ~, idx] = unique(scan_parameter_values(:), 'stable');
N_params = numel(scan_parameter_values);
elseif iscell(scan_parameter_values)
% --- Multi-parameter case (cell array of row vectors) ---
params = cell2mat(scan_parameter_values); % convert to numeric matrix
[~, ~, idx] = unique(params, 'rows', 'stable');
N_params = numel(scan_parameter_values);
else
error('Unsupported format for raw scan parameter values.');
end
% ===== Determine unique scan parameter values =====
if isnumeric(scan_parameter_values) && isvector(scan_parameter_values)
[unique_scan_parameter_values, ~, idx] = unique(scan_parameter_values(:), 'stable');
elseif iscell(scan_parameter_values)
params = cell2mat(scan_parameter_values);
[unique_scan_parameter_values, ~, idx] = unique(params, 'rows', 'stable');
else
error('Unsupported format for scan_parameter_values.');
end
% ===== Angular settings =====
angle_range = 180;
angle_per_bin = angle_range / N_angular_bins;
max_peak_bin = round(180 / angle_per_bin);
window_size = 10;
angle_threshold = 100;
N_unique = size(unique_scan_parameter_values, 1);
% ===== Preallocate result arrays =====
mean_max_g2_values = zeros(1, N_params);
skew_max_g2_angle_values = zeros(1, N_params);
var_max_g2_values = zeros(1, N_params);
fourth_order_cumulant_max_g2_angle_values = zeros(1, N_params);
max_g2_all_per_scan_parameter_value = cell(1, N_params);
std_error_g2_values = zeros(1, N_params);
% ===== Angular settings =====
angle_range = 180;
angle_per_bin = angle_range / N_angular_bins;
max_peak_bin = round(180 / angle_per_bin);
window_size = 10;
angle_threshold = 100;
% ===== Compute correlations and cumulants per group =====
for i = 1:N_params
group_idx = find(idx == i);
group_data = delta_nkr_all(group_idx, :);
N_reps = size(group_data, 1);
% ===== Preallocate result arrays based on unique values =====
mean_max_g2_values = zeros(1, N_unique);
skew_max_g2_angle_values = zeros(1, N_unique);
var_max_g2_values = zeros(1, N_unique);
fourth_order_cumulant_max_g2_angle_values = zeros(1, N_unique);
max_g2_all_per_scan_parameter_value = cell(1, N_unique);
std_error_g2_values = zeros(1, N_unique);
g2_values = zeros(1, N_reps);
% ===== Compute correlations and cumulants per unique parameter =====
for i = 1:N_unique
group_idx = find(idx == i); % all repetitions for this unique value
group_data = delta_nkr_all(group_idx, :);
N_reps = size(group_data, 1);
for j = 1:N_reps
profile = group_data(j, :);
g2_values = zeros(1, N_reps);
% Find highest peak in 0180° range
restricted_profile = profile(1:max_peak_bin);
[~, peak_idx_rel] = max(restricted_profile);
peak_idx = peak_idx_rel;
peak_angle = (peak_idx - 1) * angle_per_bin;
for j = 1:N_reps
profile = group_data(j, :);
% Determine offsets for secondary peak correlation
if peak_angle < angle_threshold
offsets = round(50 / angle_per_bin) : round(70 / angle_per_bin);
else
offsets = -round(70 / angle_per_bin) : -round(50 / angle_per_bin);
end
% Find highest peak in 0180° range
restricted_profile = profile(1:max_peak_bin);
[~, peak_idx_rel] = max(restricted_profile);
peak_idx = peak_idx_rel;
peak_angle = (peak_idx - 1) * angle_per_bin;
ref_window = mod((peak_idx - window_size):(peak_idx + window_size) - 1, N_angular_bins) + 1;
ref = profile(ref_window);
correlations = zeros(size(offsets));
for k_off = 1:length(offsets)
shifted_idx = mod(peak_idx + offsets(k_off) - 1, N_angular_bins) + 1;
sec_window = mod((shifted_idx - window_size):(shifted_idx + window_size) - 1, N_angular_bins) + 1;
sec = profile(sec_window);
correlations(k_off) = mean(ref .* sec) / mean(ref.^2);
end
[max_corr, ~] = max(correlations);
g2_values(j) = max_corr;
% Determine offsets for secondary peak correlation
if peak_angle < angle_threshold
offsets = round(50 / angle_per_bin) : round(70 / angle_per_bin);
else
offsets = -round(70 / angle_per_bin) : -round(50 / angle_per_bin);
end
% Store raw values
max_g2_all_per_scan_parameter_value{i} = g2_values;
ref_window = mod((peak_idx - window_size):(peak_idx + window_size) - 1, N_angular_bins) + 1;
ref = profile(ref_window);
% Compute cumulants
kappa = Calculator.computeCumulants(g2_values(:), 4);
correlations = zeros(size(offsets));
for k_off = 1:length(offsets)
shifted_idx = mod(peak_idx + offsets(k_off) - 1, N_angular_bins) + 1;
sec_window = mod((shifted_idx - window_size):(shifted_idx + window_size) - 1, N_angular_bins) + 1;
sec = profile(sec_window);
correlations(k_off) = mean(ref .* sec) / mean(ref.^2);
end
mean_max_g2_values(i) = kappa(1);
var_max_g2_values(i) = kappa(2);
skew_max_g2_angle_values(i) = kappa(3);
fourth_order_cumulant_max_g2_angle_values(i) = kappa(4);
N_eff = sum(~isnan(g2_values));
std_error_g2_values(i) = sqrt(kappa(2)) / sqrt(N_eff);
[max_corr, ~] = max(correlations);
g2_values(j) = max_corr;
end
% ===== Package results into struct =====
results = struct();
results.mean_max_g2 = mean_max_g2_values;
results.var_max_g2 = var_max_g2_values;
results.skew_max_g2_angle = skew_max_g2_angle_values;
results.fourth_order_cumulant_max_g2 = fourth_order_cumulant_max_g2_angle_values;
results.std_error_g2 = std_error_g2_values;
results.max_g2_all_per_scan_parameter_value = max_g2_all_per_scan_parameter_value;
% Store all repetitions for this unique parameter
max_g2_all_per_scan_parameter_value{i} = g2_values;
% Compute cumulants
kappa = Calculator.computeCumulants(g2_values(:), 4);
mean_max_g2_values(i) = kappa(1);
var_max_g2_values(i) = kappa(2);
skew_max_g2_angle_values(i) = kappa(3);
fourth_order_cumulant_max_g2_angle_values(i) = kappa(4);
N_eff = sum(~isnan(g2_values));
std_error_g2_values(i) = sqrt(kappa(2)) / sqrt(N_eff);
end
% ===== Package results into struct =====
results = struct();
results.mean_max_g2 = mean_max_g2_values;
results.var_max_g2 = var_max_g2_values;
results.skew_max_g2_angle = skew_max_g2_angle_values;
results.fourth_order_cumulant_max_g2 = fourth_order_cumulant_max_g2_angle_values;
results.std_error_g2 = std_error_g2_values;
results.max_g2_all_per_scan_parameter_value = max_g2_all_per_scan_parameter_value;
results.scan_parameter_values = unique_scan_parameter_values;
end

View File

@ -94,7 +94,7 @@ function plotAndCompareG2Cumulants(results1, results2, varargin)
% Dataset 2 -> dashed line + marker
plot(ax, x2, squeeze(kappa2(th,:,k)), ...
'LineStyle', lineStyles{2}, 'Color', c, ...
'LineWidth', 2, 'Marker', '^', 'MarkerSize', 7, ...
'LineWidth', 2, 'Marker', 's', 'MarkerSize', 7, ...
'MarkerFaceColor', c);
end
@ -113,12 +113,18 @@ function plotAndCompareG2Cumulants(results1, results2, varargin)
end
% --- Dataset legend (solid/dashed + marker) ---
axLegend = axes(fig,'Position',[0 0.91 1 0.05],'Visible','off'); hold(axLegend,'on');
d1 = plot(axLegend, NaN, NaN, 'LineStyle',lineStyles{1}, 'Color','k', 'Marker','none', 'LineWidth',2);
d2 = plot(axLegend, NaN, NaN, 'LineStyle',lineStyles{2}, 'Color','k', 'Marker','none', 'LineWidth',2);
axLegend = axes(fig,'Position',[0 0.91 1 0.05],'Visible','off');
hold(axLegend,'on');
% Dummy plots with line style + marker in black
d1 = plot(axLegend, NaN, NaN, 'LineStyle', lineStyles{1}, ...
'Color','k', 'Marker','o', 'MarkerFaceColor','k', 'MarkerSize',7, 'LineWidth',2);
d2 = plot(axLegend, NaN, NaN, 'LineStyle', lineStyles{2}, ...
'Color','k', 'Marker','s', 'MarkerFaceColor','k', 'MarkerSize',7, 'LineWidth',2);
legend(axLegend,[d1 d2],{'D -> S','S -> D'}, ...
'FontName', opts.FontName, 'FontSize', opts.FontSize-2, ...
'Orientation','horizontal', 'Box','off','Location','north');
'Orientation','horizontal', 'Box','off', 'Location','north');
% --- Save figure ---
if ~opts.SkipSaveFigures

View File

@ -14,6 +14,7 @@ function plotAndCompareG2Mean(results1, results2, varargin)
addParameter(p, 'Title', 'Mean Comparison', @(x) ischar(x) || isstring(x));
addParameter(p, 'XLabel', 'Scan Parameter', @(x) ischar(x) || isstring(x));
addParameter(p, 'YLabel', 'Mean (\kappa_1)', @(x) ischar(x) || isstring(x));
addParameter(p, 'YLimits', [], @(x) isnumeric(x) && numel(x)==2);
addParameter(p, 'FontName', 'Arial', @ischar);
addParameter(p, 'FontSize', 14, @isnumeric);
addParameter(p, 'FigNum', [], @(x) isempty(x) || (isnumeric(x) && isscalar(x)));
@ -57,7 +58,6 @@ function plotAndCompareG2Mean(results1, results2, varargin)
% --- Legend labels for θ ---
thetaLabels = arrayfun(@(t) sprintf('\\pi/%g', round(pi/t)), opts.DesiredTheta, 'UniformOutput', false);
% --- Line styles for datasets ---
lineStyles = {'-', '--'}; % solid for dataset1, dashed for dataset2
@ -88,6 +88,11 @@ function plotAndCompareG2Mean(results1, results2, varargin)
set(fig,'Color','w','Position',[100 100 950 750]);
ax = axes(fig); hold(ax,'on'); grid(ax,'on');
% Set axes font for labels and numbers
set(ax, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
if ~isempty(opts.YLimits)
ylim(ax, opts.YLimits);
end
xlabel(ax, opts.XLabel, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
ylabel(ax, opts.YLabel, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
title(ax, opts.Title, 'FontName', opts.FontName, 'FontSize', opts.FontSize+2);
@ -104,7 +109,7 @@ function plotAndCompareG2Mean(results1, results2, varargin)
errorbar(ax, x2, yMean2(:,idx), ySEM2(:,idx), 'LineStyle', lineStyles{2}, ...
'Color', c, 'LineWidth', 2, 'Marker', 's', 'MarkerSize', 7, 'MarkerFaceColor', c);
end
% --- Line-only legend for θ ---
thetaHandles = gobjects(Ntheta,1);
for m = 1:Ntheta
@ -117,16 +122,18 @@ function plotAndCompareG2Mean(results1, results2, varargin)
axLegend = axes(fig,'Position',[0.65 0.65 0.25 0.15],'Visible','off');
hold(axLegend,'on');
d1 = plot(axLegend, NaN, NaN, 'LineStyle',lineStyles{1}, ...
'Color','k', 'Marker','none', 'LineWidth',2);
d2 = plot(axLegend, NaN, NaN, 'LineStyle',lineStyles{2}, ...
'Color','k', 'Marker','none', 'LineWidth',2);
% Create dummy plots for legend with line style + marker in black
d1 = plot(axLegend, NaN, NaN, 'LineStyle', lineStyles{1}, ...
'Color','k', 'Marker','o', 'MarkerFaceColor','k', 'MarkerSize',7, 'LineWidth',2);
d2 = plot(axLegend, NaN, NaN, 'LineStyle', lineStyles{2}, ...
'Color','k', 'Marker','s', 'MarkerFaceColor','k', 'MarkerSize',7, 'LineWidth',2);
legend(axLegend,[d1 d2],{'D -> S','S -> D'}, ...
'FontName', opts.FontName, 'FontSize', opts.FontSize+2, ...
'Orientation','vertical', 'Box','off');
% --- Save figure ---
if ~opts.SkipSaveFigures
if ~exist(opts.SaveDirectory,'dir'), mkdir(opts.SaveDirectory); end

View File

@ -63,8 +63,8 @@ function plotG2Curves(results, varargin)
end
% --- Mean + SEM shading ---
mu = g2_mean(i,:);
se = g2_err(i,:);
mu = g2_mean{i};
se = g2_err{i};
fill(ax, [theta fliplr(theta)], [mu-se fliplr(mu+se)], ...
[0.2 0.4 0.8], 'FaceAlpha',0.2, 'EdgeColor','none');

View File

@ -105,7 +105,7 @@ function plotG2CurvesMultiParam(results, scan_parameter_values, scan_reference_v
% --- Axes formatting ---
grid(ax,'on');
xlabel(ax, '\theta / \pi', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
xlabel(ax, '\delta\theta / \pi', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
ylabel(ax, 'g^2(\theta)', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
title(ax, sprintf('%s=%.3g, %s=%.1f', opts.Param1Name, P1, opts.Param2Name, P2), ...
'FontName', opts.FontName, 'FontSize', opts.FontSize);

View File

@ -46,6 +46,7 @@ function plotG2Features(results, varargin)
errorbar(x, A2m, A2e,'-o','LineWidth',1.5,'Color',colors(1,:),'MarkerFaceColor',colors(1,:));
errorbar(x, A4m, A4e,'-s','LineWidth',1.5,'Color',colors(2,:),'MarkerFaceColor',colors(2,:));
errorbar(x, A6m, A6e,'-^','LineWidth',1.5,'Color',colors(3,:),'MarkerFaceColor',colors(3,:));
xlabel(ax1,opts.XLabel,'FontName',opts.FontName,'FontSize',opts.FontSize);
ylabel(ax1,'Amplitude','FontName',opts.FontName,'FontSize',opts.FontSize);
title(ax1,'Harmonic Amplitudes','FontName',opts.FontName,'FontSize',opts.FontSize+2);
legend(ax1,'|A2|','|A4|','|A6|','Location','best'); grid(ax1,'on');
@ -56,6 +57,7 @@ function plotG2Features(results, varargin)
errorbar(x, S2m, S2e,'-o','LineWidth',1.5,'Color',colors(1,:),'MarkerFaceColor',colors(1,:));
errorbar(x, Q4m, Q4e,'-s','LineWidth',1.5,'Color',colors(2,:),'MarkerFaceColor',colors(2,:));
errorbar(x, H6m, H6e,'-^','LineWidth',1.5,'Color',colors(3,:),'MarkerFaceColor',colors(3,:));
xlabel(ax2,opts.XLabel,'FontName',opts.FontName,'FontSize',opts.FontSize);
ylabel(ax2,'Symmetry Fraction','FontName',opts.FontName,'FontSize',opts.FontSize);
ylim(ax2,[0 1]); grid(ax2,'on');
title(ax2,'Symmetry Fractions','FontName',opts.FontName,'FontSize',opts.FontSize+2);
@ -78,6 +80,7 @@ function plotG2Features(results, varargin)
hold on;
% Plot mean-curve contrast on top
errorbar(x, Nrm, Nrme,'-d','LineWidth',1.5,'Color',[0.6 0.2 0.8],'MarkerFaceColor',[0.6 0.2 0.8]);
xlabel(ax3,opts.XLabel,'FontName',opts.FontName,'FontSize',opts.FontSize);
ylabel(ax3,'Contrast','FontName',opts.FontName,'FontSize',opts.FontSize);
title(ax3,'g^2 Curve Contrast','FontName',opts.FontName,'FontSize',opts.FontSize+2);
grid(ax3,'on'); set(ax3,'FontName',opts.FontName,'FontSize',opts.FontSize);
@ -89,15 +92,11 @@ function plotG2Features(results, varargin)
maxPeaks = rad2deg(cellfun(@(s) s.MaxPeakAngle, results.meanCurve));
plot(x, maxPeaks,'-o','LineWidth',1.5,'Color',[0.8 0.3 0.0],'MarkerFaceColor',[0.8 0.3 0.0]);
ylim(ax4, [10, 90])
ylabel(ax4,'\theta (degrees)','Interpreter','tex','FontSize',opts.FontSize);
xlabel(ax4,opts.XLabel,'FontName',opts.FontName,'FontSize',opts.FontSize);
ylabel(ax4,'\theta (degrees)','Interpreter','tex','FontSize',opts.FontSize);
title(ax4,'Max peak in mean g^2 curve','FontName',opts.FontName,'FontSize',opts.FontSize+2);
grid(ax4,'on'); set(ax4,'FontName',opts.FontName,'FontSize',opts.FontSize);
% --- Global x-label for entire figure ---
xlabel(t,opts.XLabel,'FontName',opts.FontName,'FontSize',opts.FontSize);
%% --- Save figure ---
if ~opts.SkipSaveFigures
if ~exist(opts.SaveDirectory,'dir'), mkdir(opts.SaveDirectory); end

View File

@ -1,8 +1,8 @@
function plotG2(g2_all, g2_error_all, theta_values, scan_parameter_values, scan_parameter_units, varargin)
function plotG2MeanCurves(g2_mean_all, g2_error_all, theta_values, scan_parameter_values, scan_parameter_units, varargin)
%% plotG2: Plots g2 angular correlations with optional parameters
%
% Usage:
% plotG2(g2_all, g2_error_all, theta_values, unique_scan_parameter_values, scan_parameter, ...
% plotG2(g2_mean_all, g2_error_all, theta_values, unique_scan_parameter_values, scan_parameter, ...
% 'Title', 'My Title', 'XLabel', 'B (G)', 'YLabel', '$g^{(2)}$', ...
% 'FigNum', 1, 'FontName', 'Arial', 'Colormap', @Colormaps.coolwarm, ...
% 'SaveFileName', 'myplot.fig', 'SaveDirectory', 'results')
@ -23,7 +23,7 @@ function plotG2(g2_all, g2_error_all, theta_values, scan_parameter_values, scan_
parse(p, varargin{:});
opts = p.Results;
nParams = size(g2_all, 1);
nParams = size(g2_mean_all, 2);
% Determine unit suffix and interpreter
switch lower(scan_parameter_units)
@ -54,7 +54,7 @@ function plotG2(g2_all, g2_error_all, theta_values, scan_parameter_values, scan_
% --- Plot data with errorbars ---
legend_entries = cell(nParams, 1);
for i = 1:nParams
errorbar(theta_values/pi, g2_all(i,:), g2_error_all(i,:), ...
errorbar(theta_values/pi, g2_mean_all{i}, g2_error_all{i}, ...
'o', 'Color', cmap(i,:), 'MarkerSize', 4, 'MarkerFaceColor', cmap(i,:), 'CapSize', 4);
% Update overlay text with scan parameter + unit

View File

@ -1,10 +1,10 @@
function plotG2MeanHeatmap(results, theta_query, scan_parameter_values, scan_reference_values, varargin)
function plotG2MeanHeatmap(results, theta_query, scan_reference_values, varargin)
%% plotG2MeanHeatmap: Plots a heatmap of mean g² values at a specified theta across the phase diagram
%
% Usage:
% plotG2MeanHeatmap(results, pi/6, scan_parameter_values, scan_reference_values, ...
% 'FigNum', 1, 'Colormap', @jet, 'CLim', [], 'ColorScale', 'linear', ...
% 'XLabel', '\alpha (degrees)', 'YLabel', 'BField (G)', ...
% 'XLabel', 'Param1', 'YLabel', 'Param2', ...
% 'Title', 'Mean g²', 'SaveFileName', 'g2MeanHeatmap.fig', ...
% 'SaveDirectory', 'results', 'SkipSaveFigures', false);
@ -14,8 +14,8 @@ function plotG2MeanHeatmap(results, theta_query, scan_parameter_values, scan_ref
addParameter(p, 'Colormap', @jet);
addParameter(p, 'CLim', []);
addParameter(p, 'ColorScale', 'linear', @(x) any(validatestring(x,{'linear','log'})));
addParameter(p, 'XLabel', '\alpha (degrees)');
addParameter(p, 'YLabel', 'BField (G)');
addParameter(p, 'XLabel', 'Param1');
addParameter(p, 'YLabel', 'Param2');
addParameter(p, 'Title', 'Mean g²');
addParameter(p, 'FontName', 'Arial');
addParameter(p, 'FontSize', 14);
@ -26,42 +26,42 @@ function plotG2MeanHeatmap(results, theta_query, scan_parameter_values, scan_ref
opts = p.Results;
% --- Extract data at requested theta ---
theta_vals = results.theta_values;
[~, idx_theta] = min(abs(theta_vals - theta_query)); % closest index
N_total = numel(results.g2_curves);
dataCell = cell(N_total,1);
theta_vals = results.theta_values;
[~, idx_theta] = min(abs(theta_vals - theta_query)); % closest index
N_total = numel(results.g2_curves);
dataCell = cell(N_total,1);
for i = 1:N_total
G = results.g2_curves{i}; % [N_reps × Nθ]
G = results.g2_curves{i}; % [N_reps × Nθ]
dataCell{i} = G(:, idx_theta); % all repetitions at chosen theta
end
% --- Convert reference/parameter values to numeric arrays ---
scanRefArray = cell2mat(scan_reference_values(:)); % nParams × 2
scanParamArray = cell2mat(scan_parameter_values(:)); % nTotal × 2
scanRefArray = cell2mat(scan_reference_values(:)); % nParams × 2
BFields = sort(unique(scanRefArray(:,1)), 'ascend'); % rows
alphas = sort(unique(scanRefArray(:,2)), 'ascend'); % cols
nB = numel(BFields);
nA = numel(alphas);
% --- Determine unique X and Y values ---
XValues = sort(unique(scanRefArray(:,2)), 'ascend'); % Param1 X
YValues = sort(unique(scanRefArray(:,1)), 'ascend'); % Param2 Y
nX = numel(XValues);
nY = numel(YValues);
% --- Preallocate data matrix ---
data_matrix = NaN(nB, nA);
data_matrix = NaN(nY, nX);
% --- Fill matrix by looping over unique parameter pairs ---
for k = 1:size(scanRefArray,1)
B = scanRefArray(k,1);
alpha = scanRefArray(k,2);
row = find(ismembertol(BFields, B, 1e-6));
col = find(ismembertol(alphas, alpha, 1e-6));
% --- Fill matrix by looping over parameter pairs ---
for k = 1:N_total
X = scanRefArray(k,2);
Y = scanRefArray(k,1);
row = find(ismembertol(YValues, Y, 1e-6));
col = find(ismembertol(XValues, X, 1e-6));
if isempty(row) || isempty(col), continue; end
repIdx = find(ismembertol(scanParamArray, [B alpha], 1e-6, 'ByRows', true));
if isempty(repIdx), continue; end
% Extract mean g² across repetitions
vals = cellfun(@(x) mean(x, 'omitnan'), dataCell(repIdx));
% Get g² values for this (Y,X)
G = results.g2_curves{k}; % [N_reps × Nθ]
vals = G(:, idx_theta); % repetitions at chosen θ
% Store mean
data_matrix(row,col) = mean(vals, 'omitnan');
end
@ -75,44 +75,42 @@ function plotG2MeanHeatmap(results, theta_query, scan_parameter_values, scan_ref
set(fig, 'Color', 'w', 'Position', [100 100 950 750]);
% --- Plot heatmap ---
imagesc(alphas, BFields, data_matrix);
imagesc(XValues, YValues, data_matrix);
set(gca, ...
'FontName', opts.FontName, ...
'FontSize', opts.FontSize, ...
'YDir', 'normal', ...
'ColorScale', opts.ColorScale); % linear or log
'ColorScale', opts.ColorScale);
% --- Labels and title ---
xlabel(opts.XLabel, 'Interpreter', 'tex', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
ylabel(opts.YLabel, 'Interpreter', 'tex', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
% --- Compute fraction of pi ---
theta_factor = theta_query / pi; % e.g., pi/6 -> 1/6
% --- Format as string ---
if abs(round(1/theta_factor) - 1/theta_factor) < 1e-6 % e.g., 1/6
% --- Compute fraction of pi for theta label ---
theta_factor = theta_query / pi;
if abs(round(1/theta_factor) - 1/theta_factor) < 1e-6
theta_str = sprintf('\\pi/%d', round(1/theta_factor));
elseif abs(theta_factor - round(theta_factor)) < 1e-6 % e.g., pi or 2*pi
elseif abs(theta_factor - round(theta_factor)) < 1e-6
theta_str = sprintf('%d\\pi', round(theta_factor));
else
theta_str = sprintf('%.3g \\pi', theta_factor); % fallback numeric
theta_str = sprintf('%.3g \\pi', theta_factor);
end
% --- Set title ---
title(sprintf('%s | Mean g^{(2)}(\\delta\\theta) at \\delta\\theta = %s', opts.Title, theta_str), ...
title(sprintf('%s | Mean g^{(2)}(\\delta\\theta = %s)', ...
opts.Title, theta_str), ...
'FontName', opts.FontName, 'FontSize', opts.FontSize + 2, 'FontWeight', 'bold');
% --- Colorbar ---
colormap(feval(opts.Colormap));
if ~isempty(opts.CLim)
caxis(opts.CLim);
end
c = colorbar;
colorbar;
% --- Save figure ---
if ~opts.SkipSaveFigures
if ~exist(opts.SaveDirectory,'dir'), mkdir(opts.SaveDirectory); end
savefig(fig, fullfile(opts.SaveDirectory, opts.SaveFileName));
end
end
end

View File

@ -118,7 +118,7 @@ function plotG2PDF(results, theta_query, varargin)
end
% --- Set title ---
title(sprintf('%s | g^{(2)}(\\delta\\theta) at \\delta\\theta = %s', opts.Title, theta_str), ...
title(sprintf('%s | g^{(2)}(\\delta\\theta = %s)', opts.Title, theta_str), ...
'FontName', opts.FontName, 'FontSize', opts.FontSize + 2, 'FontWeight', 'bold');
colormap(feval(opts.Colormap));

View File

@ -5,24 +5,26 @@ function plotHeatmap(results, scan_parameter_values, scan_reference_values, fiel
% plotHeatmap(results, scan_parameter_values, scan_reference_values, 'energy', ...
% 'FigNum', 1, 'Colormap', parula, 'CLim', [0 1], ...
% 'ColorScale', 'log', ...
% 'XLabel', '\alpha (degrees)', 'YLabel', 'BField (G)', ...
% 'XLabel', 'Param1', 'YLabel', 'Param2', ...
% 'Title', 'My Title', 'SaveFileName', 'heatmap.fig', ...
% 'SaveDirectory', 'results', 'SkipSaveFigures', false);
% 'SaveDirectory', 'results', 'SkipSaveFigures', false, ...
% 'PlotDirectly', false);
% --- Parse optional inputs ---
p = inputParser;
addParameter(p, 'FigNum', []);
addParameter(p, 'Colormap', parula);
addParameter(p, 'CLim', []);
addParameter(p, 'ColorScale', 'linear', @(x) any(validatestring(x,{'linear','log'}))); % NEW
addParameter(p, 'XLabel', '\alpha (degrees)');
addParameter(p, 'YLabel', 'BField (G)');
addParameter(p, 'ColorScale', 'linear', @(x) any(validatestring(x,{'linear','log'})));
addParameter(p, 'XLabel', 'Param1');
addParameter(p, 'YLabel', 'Param2');
addParameter(p, 'Title', fieldName);
addParameter(p, 'FontName', 'Arial');
addParameter(p, 'FontSize', 14);
addParameter(p, 'SkipSaveFigures', false, @islogical);
addParameter(p, 'SaveFileName', 'heatmap.fig', @ischar);
addParameter(p, 'SaveDirectory', pwd, @ischar);
addParameter(p, 'PlotDirectly', false, @islogical);
parse(p, varargin{:});
opts = p.Results;
@ -30,28 +32,33 @@ function plotHeatmap(results, scan_parameter_values, scan_reference_values, fiel
scanRefArray = cell2mat(scan_reference_values(:)); % nParams × 2
scanParamArray = cell2mat(scan_parameter_values(:)); % nTotal × 2
BFields = sort(unique(scanRefArray(:,1)), 'ascend'); % rows
alphas = sort(unique(scanRefArray(:,2)), 'ascend'); % cols
nB = numel(BFields);
nA = numel(alphas);
% --- Determine unique X and Y values ---
XValues = sort(unique(scanRefArray(:,2)), 'ascend'); % Param1 X
YValues = sort(unique(scanRefArray(:,1)), 'ascend'); % Param2 Y
nX = numel(XValues);
nY = numel(YValues);
% --- Preallocate data matrix ---
data_matrix = NaN(nB, nA);
data_matrix = NaN(nY, nX);
% --- Fill matrix by looping over unique parameter pairs ---
for k = 1:size(scanRefArray,1)
B = scanRefArray(k,1);
alpha = scanRefArray(k,2);
X = scanRefArray(k,2);
Y = scanRefArray(k,1);
row = find(ismembertol(BFields, B, 1e-6));
col = find(ismembertol(alphas, alpha, 1e-6));
row = find(ismembertol(YValues, Y, 1e-6));
col = find(ismembertol(XValues, X, 1e-6));
if isempty(row) || isempty(col), continue; end
repIdx = find(ismembertol(scanParamArray, [B alpha], 1e-6, 'ByRows', true));
repIdx = find(ismembertol(scanParamArray, [Y X], 1e-6, 'ByRows', true));
if isempty(repIdx), continue; end
vals = results.(fieldName)(repIdx);
data_matrix(row,col) = mean(vals, 'omitnan');
if opts.PlotDirectly
data_matrix(row,col) = results.(fieldName)(k);
else
vals = results.(fieldName)(repIdx);
data_matrix(row,col) = mean(vals, 'omitnan');
end
end
% --- Create figure ---
@ -64,7 +71,7 @@ function plotHeatmap(results, scan_parameter_values, scan_reference_values, fiel
set(fig, 'Color', 'w', 'Position', [100 100 950 750]);
% --- Plot heatmap ---
imagesc(alphas, BFields, data_matrix);
imagesc(XValues, YValues, data_matrix);
colormap(feval(opts.Colormap));
if ~isempty(opts.CLim)
caxis(opts.CLim);
@ -73,7 +80,7 @@ function plotHeatmap(results, scan_parameter_values, scan_reference_values, fiel
'FontName', opts.FontName, ...
'FontSize', opts.FontSize, ...
'YDir', 'normal', ...
'ColorScale', opts.ColorScale); % <-- linear or log
'ColorScale', opts.ColorScale);
% --- Labels and title ---
xlabel(opts.XLabel, 'Interpreter', 'tex', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
@ -86,4 +93,4 @@ function plotHeatmap(results, scan_parameter_values, scan_reference_values, fiel
'SaveFileName', opts.SaveFileName, ...
'SaveDirectory', opts.SaveDirectory, ...
'SkipSaveFigures', opts.SkipSaveFigures);
end
end

View File

@ -148,7 +148,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'Title', options.titleString, ...
'XLabel', '\theta / \pi', ...
'XLabel', '\delta\theta / \pi', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
@ -178,7 +178,7 @@ Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 8, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -187,7 +187,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 9, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -199,7 +199,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
scan_reference_values, ...
'Title', options.titleString, ...
'XLabel', 'B (G)', ...
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
'YLabel', '$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', ...
'FigNum', 10, ...
'FontName', options.font, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -3,7 +3,7 @@ datasetIdx = 1; % <-- change this to 1, 2, 3, ...
datasetName = sprintf('Dataset_%d', datasetIdx);
% --- Base directory selection ---
useLocalBaseDir = false; % <-- set true to use script location, false to use manual path
useLocalBaseDir = true; % <-- set true to use script location, false to use manual path
if useLocalBaseDir
% Use folder where this script is located
@ -74,7 +74,7 @@ Plotter.plotMeanWithSE(scan_parameter_values, compiled_results.custom_g_results.
'SkipSaveFigures', options.skipSaveFigures);
%% ------------------ 2. g²(θ) across transition ------------------
Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
Plotter.plotG2MeanCurves(compiled_results.full_g2_results.g2_mean, ...
compiled_results.full_g2_results.g2_error, ...
compiled_results.full_g2_results.theta_values, ...
scan_reference_values, ...
@ -95,7 +95,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'Title', options.titleString, ...
'XLabel', '\theta / \pi', ...
'XLabel', '\delta\theta / \pi', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
@ -108,7 +108,7 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
'Title', options.titleString, ...
'XLabel', '\alpha', ...
'XLabel', '\alpha (degrees)', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'FontName', options.font, ...
'FontSize', 16, ...
@ -125,7 +125,7 @@ Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 7, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -134,7 +134,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 8, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -146,7 +146,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
scan_reference_values, ...
'Title', options.titleString, ...
'XLabel', 'B (G)', ...
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
'YLabel', '$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', ...
'FigNum', 9, ...
'FontName', options.font, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -149,7 +149,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'Title', options.titleString, ...
'XLabel', '\theta / \pi', ...
'XLabel', '\delta\theta / \pi', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
@ -179,7 +179,7 @@ Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 8, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -188,7 +188,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 9, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -200,7 +200,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
scan_reference_values, ...
'Title', options.titleString, ...
'XLabel', 'B (G)', ...
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
'YLabel', '$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', ...
'FigNum', 10, ...
'FontName', options.font, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -3,7 +3,7 @@ datasetIdx = 1; % <-- change this to 1, 2, 3, ...
datasetName = sprintf('Dataset_%d', datasetIdx);
% --- Base directory selection ---
useLocalBaseDir = false; % <-- set true to use script location, false to use manual path
useLocalBaseDir = true; % <-- set true to use script location, false to use manual path
if useLocalBaseDir
% Use folder where this script is located
@ -74,7 +74,7 @@ Plotter.plotMeanWithSE(scan_parameter_values, compiled_results.custom_g_results.
'SkipSaveFigures', options.skipSaveFigures);
%% ------------------ 2. g²(θ) across transition ------------------
Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
Plotter.plotG2MeanCurves(compiled_results.full_g2_results.g2_mean, ...
compiled_results.full_g2_results.g2_error, ...
compiled_results.full_g2_results.theta_values, ...
scan_reference_values, ...
@ -95,7 +95,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'Title', options.titleString, ...
'XLabel', '\theta / \pi', ...
'XLabel', '\delta\theta / \pi', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
@ -105,10 +105,11 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'SkipSaveFigures', options.skipSaveFigures, ...
'SaveFileName', 'G2Curves.fig', ...
'SaveDirectory', figSaveDir);
%%
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/6, ...
'Title', options.titleString, ...
'XLabel', '\alpha', ...
'XLabel', '\alpha (degrees)', ...
'YLabel', 'g^{(2)}(\delta\theta)', ...
'FontName', options.font, ...
'FontSize', 16, ...
@ -122,10 +123,10 @@ Plotter.plotG2PDF(compiled_results.full_g2_results, pi/6, ...
'Colormap', @Colormaps.coolwarm, ...
'ColorScale', 'log', ...
'XLim', [min(scan_reference_values) max(scan_reference_values)]);
%%
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 7, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -134,7 +135,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', '\alpha (degrees)', ...
'FontName', options.font, ...
'FigNum', 8, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -146,7 +147,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
scan_reference_values, ...
'Title', options.titleString, ...
'XLabel', 'B (G)', ...
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
'YLabel', '$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', ...
'FigNum', 9, ...
'FontName', options.font, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -3,7 +3,7 @@ datasetIdx = 1; % <-- change this to 1, 2, 3, ...
datasetName = sprintf('Dataset_%d', datasetIdx);
% --- Base directory selection ---
useLocalBaseDir = false; % <-- set true to use script location, false to use manual path
useLocalBaseDir = true; % <-- set true to use script location, false to use manual path
if useLocalBaseDir
% Use folder where this script is located
@ -12,8 +12,7 @@ if useLocalBaseDir
baseDir = fullfile(thisScriptDir, 'Results');
else
% Use manually specified folder
% baseDir = 'E:\Results - Experiment\202508\BECToDropletsToStripes\';
baseDir = 'C:\Users\Karthik-OfficePC\Documents\GitRepositories\Calculations\Data-Analyzer\+Scripts\PhaseDiagram\Results';
baseDir = 'E:\Results - Experiment\202508\BECToDropletsToStripes\';
end
% --- Build paths ---
@ -46,7 +45,7 @@ Plotter.plotHeatmap(compiled_results.spectral_analysis_results, scan_parameter_v
'Colormap', @Colormaps.coolwarm, ...
'ColorScale', 'log', ...
'XLabel', '\alpha (degrees)', ...
'YLabel', 'BField (G)', ...
'YLabel', 'B (G)', ...
'Title', 'Radial Spectral Contrast', ...
'FontName', options.font, ...
'FigNum', 9, ...
@ -55,10 +54,11 @@ Plotter.plotHeatmap(compiled_results.spectral_analysis_results, scan_parameter_v
%% Heatmap of mean_max_g2_values
Plotter.plotHeatmap(compiled_results.custom_g_results, scan_parameter_values, scan_reference_values, 'mean_max_g2', ...
'PlotDirectly', true, ...
'Colormap', @Colormaps.coolwarm, ...
'ColorScale', 'linear', ...
'XLabel', '\alpha (degrees)', ...
'YLabel', 'BField (G)', ...
'YLabel', 'B (G)', ...
'Title', '$\mathrm{max}[g^{(2)}_{[50,70]}(\delta\theta)]$', ...
'FontName', options.font, ...
'FigNum', 10, ...
@ -68,12 +68,12 @@ Plotter.plotHeatmap(compiled_results.custom_g_results, scan_parameter_values, sc
%% Heatmap of mean g2 values as specific theta
Plotter.plotG2MeanHeatmap(compiled_results.full_g2_results, pi/2, ...
scan_parameter_values, scan_reference_values, ...
scan_reference_values, ...
'Colormap', @Colormaps.coolwarm, ...
'CLim', [0 1.0], ...
'ColorScale', 'log', ...
'XLabel', '\alpha (degrees)', ...
'YLabel', 'BField (G)', ...
'YLabel', 'B (G)', ...
'Title', options.titleString, ...
'FontName', options.font, ...
'FigNum', 11, ...

View File

@ -56,7 +56,7 @@ options.skipFullODImagesFolderUse = false;
options.skipSaveData = false;
options.skipSaveFigures = true;
options.skipSaveProcessedOD = true;
options.skipLivePlot = false;
options.skipLivePlot = true;
options.showProgressBar = true;
% Extras