Added two new plotting routines to visualize G2 values and their cumulants at specific angles.
This commit is contained in:
parent
f2c8fc9d94
commit
ffa50e2525
125
Data-Analyzer/+Plotter/plotAndCompareG2Cumulants.m
Normal file
125
Data-Analyzer/+Plotter/plotAndCompareG2Cumulants.m
Normal file
@ -0,0 +1,125 @@
|
||||
function plotAndCompareG2Cumulants(results1, results2, varargin)
|
||||
%% plotAndCompareG2Cumulants: Compare first four cumulants of g²(θ) for two datasets
|
||||
% results1, results2 : g2_analysis_results objects
|
||||
%
|
||||
% Dataset 1 = Solid line
|
||||
% Dataset 2 = Dashed line
|
||||
% Marker shape encodes θ value (consistent across datasets)
|
||||
% Dataset colors are distinct
|
||||
|
||||
% --- Parse name-value pairs ---
|
||||
p = inputParser;
|
||||
addParameter(p, 'Title', 'g² Cumulants Comparison', @(x) ischar(x) || isstring(x));
|
||||
addParameter(p, 'XLabel', 'Scan Parameter', @(x) ischar(x) || isstring(x));
|
||||
addParameter(p, 'FontName', 'Arial', @ischar);
|
||||
addParameter(p, 'FontSize', 14, @isnumeric);
|
||||
addParameter(p, 'FigNum', [], @(x) isempty(x) || (isnumeric(x) && isscalar(x)));
|
||||
addParameter(p, 'SkipSaveFigures', false, @islogical);
|
||||
addParameter(p, 'SaveFileName', 'G2CumulantsComparison.fig', @ischar);
|
||||
addParameter(p, 'SaveDirectory', pwd, @ischar);
|
||||
addParameter(p, 'DesiredTheta', [pi/5 pi/3 pi/2], @(x) isnumeric(x) && isvector(x)); % <--- new line
|
||||
parse(p, varargin{:});
|
||||
opts = p.Results;
|
||||
|
||||
|
||||
% --- Helper to extract cumulant array ---
|
||||
function [xvals, kappa, thIdx] = extractData(results)
|
||||
N_params = numel(results.g2_cumulants);
|
||||
N_theta = size(results.g2_cumulants{1},1);
|
||||
xvals = results.summaries.scanParamVal;
|
||||
kappa = zeros(N_theta, N_params, 4);
|
||||
for i = 1:N_params
|
||||
kappa(:,i,:) = results.g2_cumulants{i};
|
||||
end
|
||||
thetaVals = results.theta_values;
|
||||
desiredTheta = opts.DesiredTheta; % use user-specified or default
|
||||
[~, thIdx] = arrayfun(@(t) min(abs(thetaVals - t)), desiredTheta);
|
||||
end
|
||||
|
||||
% --- Extract data for both results ---
|
||||
[x1, kappa1, thIdx] = extractData(results1);
|
||||
[x2, kappa2, ~] = extractData(results2);
|
||||
|
||||
% --- Legend labels for θ ---
|
||||
thetaLabels = arrayfun(@(t) sprintf('\\pi/%g', round(pi/t)), opts.DesiredTheta, 'UniformOutput', false);
|
||||
|
||||
% --- Marker per θ ---
|
||||
markerList = {'o','s','^','d','v','>','<','p','h'}; % more markers if needed
|
||||
Ntheta = numel(thIdx);
|
||||
markers = markerList(mod(0:Ntheta-1, numel(markerList))+1); % cycle if Ntheta > markerList
|
||||
|
||||
% --- Line styles for datasets ---
|
||||
lineStyles = {'-', '--'}; % solid for dataset1, dashed for dataset2
|
||||
|
||||
% --- Colors per θ (generalized, using only ends of coolwarm) ---
|
||||
cmapFull = Colormaps.coolwarm(256);
|
||||
Ntheta = numel(thIdx);
|
||||
|
||||
% pick start and end colors
|
||||
startColor = cmapFull(1, :); % deep blue
|
||||
endColor = cmapFull(end, :); % deep red
|
||||
|
||||
% interpolate RGB linearly between start and end for Ntheta points
|
||||
thetaColors = [linspace(startColor(1), endColor(1), Ntheta)', ...
|
||||
linspace(startColor(2), endColor(2), Ntheta)', ...
|
||||
linspace(startColor(3), endColor(3), Ntheta)'];
|
||||
|
||||
|
||||
% --- Create figure ---
|
||||
if isempty(opts.FigNum), fig = figure; else, fig = figure(opts.FigNum); end
|
||||
clf(fig);
|
||||
set(fig,'Color','w','Position',[100 100 950 750]);
|
||||
t = tiledlayout(2,2,'TileSpacing','Compact','Padding','Compact');
|
||||
sgtitle(opts.Title, 'FontName', opts.FontName, 'FontSize', opts.FontSize+4);
|
||||
|
||||
cumulLabels = {'\kappa_1','\kappa_2','\kappa_3','\kappa_4'};
|
||||
cumulTitles = {'Mean','Variance','Skewness','Binder Cumulant'};
|
||||
|
||||
for k = 1:4
|
||||
ax = nexttile; hold(ax,'on');
|
||||
|
||||
for idx = 1:Ntheta
|
||||
th = thIdx(idx);
|
||||
c = thetaColors(idx,:);
|
||||
|
||||
% Dataset 1 -> solid line + marker
|
||||
plot(ax, x1, squeeze(kappa1(th,:,k)), ...
|
||||
'LineStyle', lineStyles{1}, 'Color', c, ...
|
||||
'LineWidth', 2, 'Marker', 'o', 'MarkerSize', 7, ...
|
||||
'MarkerFaceColor', c);
|
||||
|
||||
% Dataset 2 -> dashed line + marker
|
||||
plot(ax, x2, squeeze(kappa2(th,:,k)), ...
|
||||
'LineStyle', lineStyles{2}, 'Color', c, ...
|
||||
'LineWidth', 2, 'Marker', '^', 'MarkerSize', 7, ...
|
||||
'MarkerFaceColor', c);
|
||||
end
|
||||
|
||||
ylabel(ax, cumulLabels{k}, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
|
||||
xlabel(ax, opts.XLabel, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
|
||||
title(ax, cumulTitles{k}, 'FontName', opts.FontName, 'FontSize', opts.FontSize+2);
|
||||
grid(ax,'on'); set(ax,'FontName',opts.FontName,'FontSize',opts.FontSize);
|
||||
|
||||
% --- Line-only legend for θ ---
|
||||
thetaHandles = gobjects(Ntheta,1);
|
||||
for m = 1:Ntheta
|
||||
thetaHandles(m) = plot(ax, NaN, NaN, ...
|
||||
'LineStyle','-', 'Color',thetaColors(m,:), 'LineWidth',6, 'Marker','none');
|
||||
end
|
||||
legend(ax, thetaHandles, thetaLabels, 'Location','northeast', 'FontSize', opts.FontSize-2);
|
||||
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);
|
||||
legend(axLegend,[d1 d2],{'D -> S','S -> D'}, ...
|
||||
'FontName', opts.FontName, 'FontSize', opts.FontSize-2, ...
|
||||
'Orientation','horizontal', 'Box','off','Location','north');
|
||||
|
||||
% --- Save figure ---
|
||||
if ~opts.SkipSaveFigures
|
||||
if ~exist(opts.SaveDirectory,'dir'), mkdir(opts.SaveDirectory); end
|
||||
savefig(fig, fullfile(opts.SaveDirectory, opts.SaveFileName));
|
||||
end
|
||||
end
|
||||
145
Data-Analyzer/+Plotter/plotG2PDF.m
Normal file
145
Data-Analyzer/+Plotter/plotG2PDF.m
Normal file
@ -0,0 +1,145 @@
|
||||
function plotG2PDF(results, theta_query, varargin)
|
||||
%% plotG2PDF: Plots 2D heatmap of PDFs of g²(θ) values for different scan parameters
|
||||
%
|
||||
% Usage:
|
||||
% plotG2PDF(results, pi/6, ...
|
||||
% 'PlotType', 'histogram', ...
|
||||
% 'NumberOfBins', 50, ...
|
||||
% 'NormalizeHistogram', true, ...
|
||||
% 'Title', 'g² PDF', ...
|
||||
% 'XLabel', 'Scan Parameter α', ...
|
||||
% 'YLabel', 'g²(\theta = \pi/6)', ...
|
||||
% 'FigNum', 1, ...
|
||||
% 'FontName', 'Arial', ...
|
||||
% 'SkipSaveFigures', false, ...
|
||||
% 'SaveFileName', 'G2PDF.fig', ...
|
||||
% 'SaveDirectory', 'results', ...
|
||||
% 'NumPoints', 200, ...
|
||||
% 'DataRange', [], ...
|
||||
% 'XLim', [], ...
|
||||
% 'Colormap', @jet);
|
||||
|
||||
% --- Parse optional inputs ---
|
||||
p = inputParser;
|
||||
addParameter(p, 'Title', '', @(x) ischar(x) || isstring(x));
|
||||
addParameter(p, 'XLabel', '', @(x) ischar(x) || isstring(x));
|
||||
addParameter(p, 'YLabel', '', @(x) ischar(x) || isstring(x));
|
||||
addParameter(p, 'FigNum', 1, @(x) isscalar(x));
|
||||
addParameter(p, 'FontName', 'Arial', @ischar);
|
||||
addParameter(p, 'FontSize', 14, @isnumeric);
|
||||
addParameter(p, 'SkipSaveFigures', false, @islogical);
|
||||
addParameter(p, 'SaveFileName', 'G2PDF.fig', @ischar);
|
||||
addParameter(p, 'SaveDirectory', pwd, @ischar);
|
||||
addParameter(p, 'NumPoints', 200, @(x) isscalar(x));
|
||||
addParameter(p, 'DataRange', [], @(x) isempty(x) || numel(x)==2);
|
||||
addParameter(p, 'XLim', [], @(x) isempty(x) || numel(x)==2);
|
||||
addParameter(p, 'Colormap', @jet);
|
||||
addParameter(p, 'ColorScale', 'linear', @(x) any(validatestring(x,{'linear','log'})));
|
||||
addParameter(p, 'PlotType', 'histogram', @(x) any(validatestring(x,{'kde','histogram'})));
|
||||
addParameter(p, 'NumberOfBins', 50, @isscalar);
|
||||
addParameter(p, 'NormalizeHistogram', true, @islogical);
|
||||
parse(p, varargin{:});
|
||||
opts = p.Results;
|
||||
|
||||
% --- Extract data at requested theta ---
|
||||
theta_vals = results.theta_values;
|
||||
[~, idx_theta] = min(abs(theta_vals - theta_query)); % closest index
|
||||
N_params = numel(results.g2_curves);
|
||||
dataCell = cell(N_params,1);
|
||||
for i = 1:N_params
|
||||
G = results.g2_curves{i}; % [N_reps × Nθ]
|
||||
dataCell{i} = G(:, idx_theta); % all repetitions at chosen theta
|
||||
end
|
||||
|
||||
referenceValues = results.scan_parameter_values;
|
||||
|
||||
% --- Determine y-range ---
|
||||
if isempty(opts.DataRange)
|
||||
allData = cell2mat(dataCell(:));
|
||||
y_min = min(allData);
|
||||
y_max = max(allData);
|
||||
else
|
||||
y_min = opts.DataRange(1);
|
||||
y_max = opts.DataRange(2);
|
||||
end
|
||||
|
||||
% --- Prepare PDF grid/matrix ---
|
||||
if strcmpi(opts.PlotType,'kde')
|
||||
y_grid = linspace(y_min, y_max, opts.NumPoints);
|
||||
pdf_matrix = zeros(numel(y_grid), N_params);
|
||||
else
|
||||
edges = linspace(y_min, y_max, opts.NumberOfBins+1);
|
||||
binCenters = (edges(1:end-1) + edges(2:end))/2;
|
||||
pdf_matrix = zeros(numel(binCenters), N_params);
|
||||
end
|
||||
|
||||
% --- Compute PDFs ---
|
||||
for i = 1:N_params
|
||||
data = dataCell{i};
|
||||
data = data(~isnan(data));
|
||||
if isempty(data), continue; end
|
||||
|
||||
if strcmpi(opts.PlotType,'kde')
|
||||
f = ksdensity(data, y_grid);
|
||||
pdf_matrix(:,i) = f;
|
||||
else
|
||||
counts = histcounts(data, edges);
|
||||
if opts.NormalizeHistogram
|
||||
binWidth = edges(2) - edges(1);
|
||||
counts = counts / (sum(counts) * binWidth);
|
||||
end
|
||||
pdf_matrix(:,i) = counts(:);
|
||||
end
|
||||
end
|
||||
|
||||
% --- Plot heatmap ---
|
||||
fig = figure(opts.FigNum); clf(fig);
|
||||
set(fig, 'Color', 'w', 'Position',[100 100 950 750]);
|
||||
if strcmpi(opts.PlotType,'kde')
|
||||
imagesc(referenceValues, y_grid, pdf_matrix);
|
||||
else
|
||||
imagesc(referenceValues, binCenters, pdf_matrix);
|
||||
end
|
||||
|
||||
set(gca, 'YDir', 'normal', 'FontName', opts.FontName, 'FontSize', opts.FontSize, 'ColorScale', opts.ColorScale);
|
||||
xlabel(opts.XLabel, 'Interpreter', 'tex', 'FontSize', opts.FontSize, 'FontName', opts.FontName);
|
||||
ylabel(opts.YLabel, 'Interpreter', 'tex', 'FontSize', opts.FontSize, 'FontName', opts.FontName);
|
||||
|
||||
% --- 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
|
||||
theta_str = sprintf('\\pi/%d', round(1/theta_factor));
|
||||
elseif abs(theta_factor - round(theta_factor)) < 1e-6 % e.g., pi or 2*pi
|
||||
theta_str = sprintf('%d\\pi', round(theta_factor));
|
||||
else
|
||||
theta_str = sprintf('%.3g \\pi', theta_factor); % fallback numeric
|
||||
end
|
||||
|
||||
% --- Set title ---
|
||||
title(sprintf('%s | g^{(2)}(\\delta\\theta) at \\theta = %s', opts.Title, theta_str), ...
|
||||
'FontName', opts.FontName, 'FontSize', opts.FontSize + 2, 'FontWeight', 'bold');
|
||||
|
||||
colormap(feval(opts.Colormap));
|
||||
c = colorbar;
|
||||
if strcmpi(opts.PlotType,'kde')
|
||||
ylabel(c, 'PDF', 'FontName', opts.FontName, 'FontSize', opts.FontSize);
|
||||
else
|
||||
if opts.NormalizeHistogram
|
||||
ylabel(c, 'Probability Density', 'Rotation', -90, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
|
||||
else
|
||||
ylabel(c, 'Counts', 'Rotation', -90, 'FontName', opts.FontName, 'FontSize', opts.FontSize);
|
||||
end
|
||||
end
|
||||
|
||||
if ~isempty(opts.XLim)
|
||||
xlim(opts.XLim);
|
||||
end
|
||||
|
||||
% --- Save figure ---
|
||||
if ~opts.SkipSaveFigures
|
||||
if ~exist(opts.SaveDirectory,'dir'), mkdir(opts.SaveDirectory); end
|
||||
savefig(fig, fullfile(opts.SaveDirectory, opts.SaveFileName));
|
||||
end
|
||||
end
|
||||
@ -142,61 +142,59 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
'SaveFileName', 'CumulantOfPeakOffsetAngularCorrelation.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 4. g²(θ) across transition ------------------
|
||||
Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
|
||||
compiled_results.full_g2_results.g2_error, ...
|
||||
compiled_results.full_g2_results.theta_values, ...
|
||||
scan_reference_values, ...
|
||||
options.scanParameterUnits, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '$\delta\theta / \pi$', ...
|
||||
'YLabel', '$g^{(2)}(\delta\theta)$', ...
|
||||
'FigNum', 6, ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2ThetaAcrossTransition.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'Colormap', @Colormaps.coolwarm);
|
||||
%% ------------------ 3. Features of g²(θ) across transition ------------------
|
||||
|
||||
%% ------------------ 5. Feature extraction of g²(θ) across transition ------------------
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
|
||||
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\theta / \pi', ...
|
||||
'YLabel', 'g^{(2)}(\theta)', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'HighlightEvery', 10, ... % highlight every 10th repetition
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 7, ...
|
||||
'TileTitlePrefix', 'B', ... % user-defined tile prefix
|
||||
'TileTitleSuffix', 'G', ... % user-defined suffix (e.g., Gauss symbol)...
|
||||
'FigNum', 6, ...
|
||||
'TileTitlePrefix', '\alpha', ... % user-defined tile prefix
|
||||
'TileTitleSuffix', '^\circ', ... % user-defined suffix (e.g., Gauss symbol)...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Curves.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'FontName', options.font, ...
|
||||
'FontSize', 16, ...
|
||||
'FigNum', 7, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2PDF_pi6.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'NumberOfBins', 20, ...
|
||||
'NormalizeHistogram', true, ...
|
||||
'DataRange', [0 1.0], ...
|
||||
'Colormap', @Colormaps.coolwarm, ...
|
||||
'ColorScale', 'log', ...
|
||||
'XLim', [min(scan_reference_values) max(scan_reference_values)]);
|
||||
|
||||
%
|
||||
Plotter.plotG2Features(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 8, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Features.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
Plotter.plotG2Cumulants(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 9, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Cumulants.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 6. PDF of max g² across transition ------------------
|
||||
%% ------------------ 4. PDF of max g² across transition ------------------
|
||||
Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_value, ...
|
||||
scan_reference_values, ...
|
||||
'Title', options.titleString, ...
|
||||
@ -214,7 +212,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
|
||||
'XLim', [min(scan_reference_values) max(scan_reference_values)]);
|
||||
|
||||
|
||||
%% ------------------ 7. Cumulants across transition ------------------
|
||||
%% ------------------ 5. Cumulants across transition ------------------
|
||||
Plotter.plotCumulants(scan_reference_values, ...
|
||||
{compiled_results.custom_g_results.mean_max_g2, compiled_results.custom_g_results.var_max_g2, compiled_results.custom_g_results.skew_max_g2_angle, compiled_results.custom_g_results.fourth_order_cumulant_max_g2}, ...
|
||||
'Title', 'Cumulants of Peak Offset Angular Correlation', ...
|
||||
@ -230,19 +228,19 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
%%
|
||||
%{
|
||||
|
||||
%% ------------------ 8. PCA ------------------
|
||||
%% ------------------ 6. PCA ------------------
|
||||
Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan_reference_values, ...
|
||||
'FigNumRange', [12,13,14,15,16,17], ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 9. Average of Spectra Plots ------------------
|
||||
%% ------------------ 7. Average of Spectra Plots ------------------
|
||||
|
||||
Plotter.plotAverageSpectra(scan_parameter_values, ...
|
||||
spectral_analysis_results, ...
|
||||
'ScanParameterName', scan_parameter, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 18, ...
|
||||
'ColormapPS', Colormaps.coolwarm(), ...
|
||||
'Font', 'Bahnschrift', ...
|
||||
'SaveFileName', 'avgSpectra.fig', ...
|
||||
|
||||
@ -88,12 +88,15 @@ Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
|
||||
'SaveFileName', 'G2ThetaAcrossTransition.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'Colormap', @Colormaps.coolwarm);
|
||||
%% ------------------ 3. Feature extraction of g²(θ) across transition ------------------
|
||||
|
||||
%% ------------------ 3. Features of g²(θ) across transition ------------------
|
||||
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
|
||||
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\theta / \pi', ...
|
||||
'YLabel', 'g^{(2)}(\theta)', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'HighlightEvery', 10, ... % highlight every 10th repetition
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 5, ...
|
||||
@ -103,25 +106,37 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'SaveFileName', 'G2Curves.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'FontName', options.font, ...
|
||||
'FontSize', 16, ...
|
||||
'FigNum', 6, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2PDF_pi6.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'NumberOfBins', 20, ...
|
||||
'NormalizeHistogram', true, ...
|
||||
'DataRange', [0 1.0], ...
|
||||
'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)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 6, ...
|
||||
'FigNum', 7, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Features.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
Plotter.plotG2Cumulants(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 8, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Cumulants.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
@ -132,7 +147,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
|
||||
'FigNum', 8, ...
|
||||
'FigNum', 9, ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'PDF_MaxG2AcrossTransition.fig', ...
|
||||
@ -149,7 +164,7 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
{compiled_results.custom_g_results.mean_max_g2, compiled_results.custom_g_results.var_max_g2, compiled_results.custom_g_results.skew_max_g2_angle, compiled_results.custom_g_results.fourth_order_cumulant_max_g2}, ...
|
||||
'Title', 'Cumulants of Peak Offset Angular Correlation', ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'FigNum', 9, ...
|
||||
'FigNum', 10, ...
|
||||
'FontName', options.font, ...
|
||||
'MarkerSize', 6, ...
|
||||
'LineWidth', 1.5, ...
|
||||
@ -162,7 +177,7 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
|
||||
%% ------------------ 6. PCA ------------------
|
||||
Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan_reference_values, ...
|
||||
'FigNumRange', [10,11,12,13,14,15], ...
|
||||
'FigNumRange', [11,12,13,14,15,16], ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
@ -172,7 +187,7 @@ Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan
|
||||
Plotter.plotAverageSpectra(scan_parameter_values, ...
|
||||
spectral_analysis_results, ...
|
||||
'ScanParameterName', scan_parameter, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 17, ...
|
||||
'ColormapPS', Colormaps.coolwarm(), ...
|
||||
'Font', 'Bahnschrift', ...
|
||||
'SaveFileName', 'avgSpectra.fig', ...
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
% Specify data location to run analysis on
|
||||
dataSources = {
|
||||
struct('sequence', 'StructuralPhaseTransition', ...
|
||||
'date', '2025/08/26', ...
|
||||
'runs', [6, 7, 8, 9, 10, 11]) % specify run numbers as a string in "" or just as a numeric value
|
||||
struct('sequence', 'TwoDGas', ...
|
||||
'date', '2025/06/23', ...
|
||||
'runs', [300]) % specify run numbers as a string in "" or just as a numeric value
|
||||
};
|
||||
|
||||
options = struct();
|
||||
|
||||
% File paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202506';
|
||||
options.measurementName = 'DropletsToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
@ -19,11 +19,11 @@ options.saveDirectory = fileparts(scriptFullPath);
|
||||
% Camera / imaging settings
|
||||
options.cam = 4; % 1 - ODT_1_Axis_Camera; 2 - ODT_2_Axis_Camera; 3 - Horizontal_Axis_Camera;, 4 - Vertical_Axis_Camera;
|
||||
options.angle = 0; % angle by which image will be rotated
|
||||
options.center = [1420, 2050];
|
||||
options.center = [1410, 2030];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
options.magnification = 24.6;
|
||||
options.magnification = 23.94;
|
||||
options.ImagingMode = 'HighIntensity';
|
||||
options.PulseDuration = 5e-6; % in s
|
||||
|
||||
|
||||
@ -143,61 +143,59 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
'SaveFileName', 'CumulantOfPeakOffsetAngularCorrelation.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 4. g²(θ) across transition ------------------
|
||||
Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
|
||||
compiled_results.full_g2_results.g2_error, ...
|
||||
compiled_results.full_g2_results.theta_values, ...
|
||||
scan_reference_values, ...
|
||||
options.scanParameterUnits, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '$\delta\theta / \pi$', ...
|
||||
'YLabel', '$g^{(2)}(\delta\theta)$', ...
|
||||
'FigNum', 6, ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2ThetaAcrossTransition.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'Colormap', @Colormaps.coolwarm);
|
||||
%% ------------------ 4. Features of g²(θ) across transition ------------------
|
||||
|
||||
%% ------------------ 5. Feature extraction of g²(θ) across transition ------------------
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
|
||||
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\theta / \pi', ...
|
||||
'YLabel', 'g^{(2)}(\theta)', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'HighlightEvery', 10, ... % highlight every 10th repetition
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 7, ...
|
||||
'TileTitlePrefix', 'B', ... % user-defined tile prefix
|
||||
'TileTitleSuffix', 'G', ... % user-defined suffix (e.g., Gauss symbol)...
|
||||
'FigNum', 6, ...
|
||||
'TileTitlePrefix', '\alpha', ... % user-defined tile prefix
|
||||
'TileTitleSuffix', '^\circ', ... % user-defined suffix (e.g., Gauss symbol)...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Curves.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/2, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'FontName', options.font, ...
|
||||
'FontSize', 16, ...
|
||||
'FigNum', 7, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2PDF_pi6.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'NumberOfBins', 20, ...
|
||||
'NormalizeHistogram', true, ...
|
||||
'DataRange', [0 1.0], ...
|
||||
'Colormap', @Colormaps.coolwarm, ...
|
||||
'ColorScale', 'log', ...
|
||||
'XLim', [min(scan_reference_values) max(scan_reference_values)]);
|
||||
|
||||
%
|
||||
Plotter.plotG2Features(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 8, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Features.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
Plotter.plotG2Cumulants(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 9, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Cumulants.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 6. PDF of max g² across transition ------------------
|
||||
%% ------------------ 5. PDF of max g² across transition ------------------
|
||||
Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_value, ...
|
||||
scan_reference_values, ...
|
||||
'Title', options.titleString, ...
|
||||
@ -215,7 +213,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
|
||||
'XLim', [min(scan_reference_values) max(scan_reference_values)]);
|
||||
|
||||
|
||||
%% ------------------ 7. Cumulants across transition ------------------
|
||||
%% ------------------ 6. Cumulants across transition ------------------
|
||||
Plotter.plotCumulants(scan_reference_values, ...
|
||||
{compiled_results.custom_g_results.mean_max_g2, compiled_results.custom_g_results.var_max_g2, compiled_results.custom_g_results.skew_max_g2_angle, compiled_results.custom_g_results.fourth_order_cumulant_max_g2}, ...
|
||||
'Title', 'Cumulants of Peak Offset Angular Correlation', ...
|
||||
@ -231,19 +229,19 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
%%
|
||||
%{
|
||||
|
||||
%% ------------------ 8. PCA ------------------
|
||||
%% ------------------ 7. PCA ------------------
|
||||
Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan_reference_values, ...
|
||||
'FigNumRange', [12,13,14,15,16,17], ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%% ------------------ 9. Average of Spectra Plots ------------------
|
||||
%% ------------------ 8. Average of Spectra Plots ------------------
|
||||
|
||||
Plotter.plotAverageSpectra(scan_parameter_values, ...
|
||||
spectral_analysis_results, ...
|
||||
'ScanParameterName', scan_parameter, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 18, ...
|
||||
'ColormapPS', Colormaps.coolwarm(), ...
|
||||
'Font', 'Bahnschrift', ...
|
||||
'SaveFileName', 'avgSpectra.fig', ...
|
||||
|
||||
@ -89,12 +89,14 @@ Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'Colormap', @Colormaps.coolwarm);
|
||||
|
||||
%% ------------------ 3. Feature extraction of g²(θ) across transition ------------------
|
||||
%% ------------------ 3. Features of g²(θ) across transition ------------------
|
||||
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
|
||||
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\theta / \pi', ...
|
||||
'YLabel', 'g^{(2)}(\theta)', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'HighlightEvery', 10, ... % highlight every 10th repetition
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 5, ...
|
||||
@ -103,24 +105,38 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Curves.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
|
||||
|
||||
%%
|
||||
Plotter.plotG2PDF(compiled_results.full_g2_results, pi/6, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha', ...
|
||||
'YLabel', 'g^{(2)}(\delta\theta)', ...
|
||||
'FontName', options.font, ...
|
||||
'FontSize', 16, ...
|
||||
'FigNum', 6, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2PDF_pi6.fig', ...
|
||||
'SaveDirectory', figSaveDir, ...
|
||||
'NumberOfBins', 20, ...
|
||||
'NormalizeHistogram', true, ...
|
||||
'DataRange', [0 1.0], ...
|
||||
'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)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 6, ...
|
||||
'FigNum', 7, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Features.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
|
||||
%
|
||||
Plotter.plotG2Cumulants(g2_analysis_results, ...
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', '\alpha (deg)', ...
|
||||
'FontName', options.font, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 8, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'G2Cumulants.fig', ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
@ -131,7 +147,7 @@ Plotter.plotPDF(compiled_results.custom_g_results.max_g2_all_per_scan_parameter_
|
||||
'Title', options.titleString, ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'YLabel', '$\mathrm{max}[g^{(2)}]$', ...
|
||||
'FigNum', 8, ...
|
||||
'FigNum', 9, ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveFileName', 'PDF_MaxG2AcrossTransition.fig', ...
|
||||
@ -148,7 +164,7 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
{compiled_results.custom_g_results.mean_max_g2, compiled_results.custom_g_results.var_max_g2, compiled_results.custom_g_results.skew_max_g2_angle, compiled_results.custom_g_results.fourth_order_cumulant_max_g2}, ...
|
||||
'Title', 'Cumulants of Peak Offset Angular Correlation', ...
|
||||
'XLabel', 'B (G)', ...
|
||||
'FigNum', 9, ...
|
||||
'FigNum', 10, ...
|
||||
'FontName', options.font, ...
|
||||
'MarkerSize', 6, ...
|
||||
'LineWidth', 1.5, ...
|
||||
@ -161,7 +177,7 @@ Plotter.plotCumulants(scan_reference_values, ...
|
||||
|
||||
%% ------------------ 6. PCA ------------------
|
||||
Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan_reference_values, ...
|
||||
'FigNumRange', [10,11,12,13,14,15], ...
|
||||
'FigNumRange', [11,12,13,14,15,16], ...
|
||||
'FontName', options.font, ...
|
||||
'SkipSaveFigures', options.skipSaveFigures, ...
|
||||
'SaveDirectory', figSaveDir);
|
||||
@ -171,7 +187,7 @@ Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan
|
||||
Plotter.plotAverageSpectra(scan_parameter_values, ...
|
||||
spectral_analysis_results, ...
|
||||
'ScanParameterName', scan_parameter, ...
|
||||
'FigNum', 7, ...
|
||||
'FigNum', 17, ...
|
||||
'ColormapPS', Colormaps.coolwarm(), ...
|
||||
'Font', 'Bahnschrift', ...
|
||||
'SaveFileName', 'avgSpectra.fig', ...
|
||||
|
||||
@ -2,16 +2,16 @@
|
||||
|
||||
% Specify data location to run analysis on
|
||||
dataSources = {
|
||||
struct('sequence', 'StructuralPhaseTransition', ...
|
||||
'date', '2025/08/16', ...
|
||||
'runs', [8, 9, 10, 11, 12, 13]) % specify run numbers as a string in "" or just as a numeric value
|
||||
struct('sequence', 'TwoDGas', ...
|
||||
'date', '2025/06/24', ...
|
||||
'runs', [1]) % specify run numbers as a string in "" or just as a numeric value
|
||||
};
|
||||
|
||||
options = struct();
|
||||
|
||||
% File paths
|
||||
options.baseDataFolder = '//DyLabNAS/Data';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
|
||||
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202506';
|
||||
options.measurementName = 'StripesToDroplets';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
@ -19,7 +19,7 @@ options.saveDirectory = fileparts(scriptFullPath);
|
||||
% Camera / imaging settings
|
||||
options.cam = 4; % 1 - ODT_1_Axis_Camera; 2 - ODT_2_Axis_Camera; 3 - Horizontal_Axis_Camera;, 4 - Vertical_Axis_Camera;
|
||||
options.angle = 0; % angle by which image will be rotated
|
||||
options.center = [1420, 2050];
|
||||
options.center = [1410, 2030];
|
||||
options.span = [200, 200];
|
||||
options.fraction = [0.1, 0.1];
|
||||
options.pixel_size = 5.86e-6; % in meters
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
dataSources = {
|
||||
struct('sequence', 'StructuralPhaseTransition', ...
|
||||
'date', '2025/08/20', ...
|
||||
'runs', [2]) % specify run numbers as a string in "" or just as a numeric value
|
||||
'runs', [1]) % specify run numbers as a string in "" or just as a numeric value
|
||||
};
|
||||
|
||||
options = struct();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user