Bugfixes, some minor enhancements.

This commit is contained in:
Karthik 2025-09-04 18:54:22 +02:00
parent 9b4412f1a2
commit 7b7af70a24
17 changed files with 59 additions and 57 deletions

View File

@ -1,4 +1,4 @@
function [results, scan_parameter_values] = performAnalysis(options)
function [results, scan_parameter_values, scan_reference_values] = performAnalysis(options)
arguments
options.scan_parameter (1,:) char
options.scan_reference_values (1,:) double
@ -50,7 +50,7 @@ function [results, scan_parameter_values] = performAnalysis(options)
end
% Collect OD images
[od_imgs, scan_parameter_values, ~] = Helper.collectODImages(options);
[od_imgs, scan_parameter_values, scan_reference_values, ~] = Helper.collectODImages(options);
% Conduct spectral analysis
fprintf('\n[INFO] Initiating spectral analysis...\n');

View File

@ -113,7 +113,7 @@ function results_all = batchAnalyze(dataSources, options)
end
if ~matched
warning('[WARNING] No matching full OD images subfolder found for sequence %s, date %s, run %s, measurementName %s.', ...
warning('No matching full OD images subfolder found for sequence %s, date %s, run %s, measurementName %s.', ...
targetSequence, targetDate, targetRun, options.measurementName);
continue; % skip this run but continue to next combination
end
@ -122,7 +122,7 @@ function results_all = batchAnalyze(dataSources, options)
try
args = [fieldnames(options), struct2cell(options)]';
args = args(:)';
[analysisResults, scan_parameter_values] = Analyzer.performAnalysis(args{:});
[analysisResults, scan_parameter_values, scan_reference_values] = Analyzer.performAnalysis(args{:});
result = struct();
result.sequence = targetSequence;
@ -132,6 +132,7 @@ function results_all = batchAnalyze(dataSources, options)
result.options = options;
result.results = analysisResults;
result.scan_parameter_values = scan_parameter_values;
result.scan_reference_values = scan_reference_values;
% Save dataset as MAT
if ~isfield(options, 'skipSaveData') || ~options.skipSaveData

View File

@ -1,4 +1,4 @@
function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
function [od_imgs, scan_parameter_values, scan_reference_values, file_list] = collectODImages(options)
%% Applies cropping, background subtraction, and optional fringe removal, optional unshuffling on OD image dataset
% Automatically reuses in-memory full dataset if available;
% otherwise, reads and processes raw HDF5 data.

View File

@ -34,16 +34,16 @@ function plotG2Curves(results, varargin)
opts = p.Results;
% --- Extract data ---
N_params = numel(results.g2_curves);
theta = results.theta_values / pi;
g2_mean = results.g2_mean;
g2_err = results.g2_error;
N_params = numel(results.g2_curves);
theta = results.theta_values / pi;
g2_mean = results.g2_mean;
g2_err = results.g2_error;
Nhighlight = opts.HighlightEvery;
% --- Create figure ---
if isempty(opts.FigNum), fig = figure; else, fig = figure(opts.FigNum); end
clf(fig);
set(fig,'Color','w','Position',[100 100 1000 800]);
set(fig,'Color','w','Position',[100 100 950 750]);
t = tiledlayout('TileSpacing','compact','Padding','compact');
title(t, opts.Title, 'FontName', opts.FontName, 'FontSize', opts.FontSize+2);

View File

@ -38,7 +38,7 @@ function plotG2Features(results, varargin)
% --- Create figure ---
if isempty(opts.FigNum), fig = figure; else, fig = figure(opts.FigNum); end
clf(fig);
set(fig,'Color','w','Position',[100 100 950 900]);
set(fig,'Color','w','Position',[100 100 950 750]);
t = tiledlayout(3,1,'TileSpacing','Compact','Padding','Compact');
t = tiledlayout(3,1,'TileSpacing','Compact','Padding','Compact');

View File

@ -15,6 +15,7 @@ data = load(dataFile);
datasetStruct = data.(datasetName);
compiled_results = datasetStruct.results;
scan_parameter_values = datasetStruct.scan_parameter_values;
scan_reference_values = datasetStruct.scan_reference_values;
% Load the original options used during analysis
options = datasetStruct.options; % exact options used for this dataset
@ -86,8 +87,8 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
'FigNum', 5, ...
'TileTitlePrefix', '\alpha', ... % user-defined tile prefix
'TileTitleSuffix', '^\circ', ... % user-defined suffix (e.g., Gauss symbol)...
'TileTitlePrefix', 'B', ... % user-defined tile prefix
'TileTitleSuffix', 'G', ... % user-defined suffix (e.g., Gauss symbol)...
'SkipSaveFigures', options.skipSaveFigures, ...
'SaveFileName', 'G2Curves.fig', ...
'SaveDirectory', figSaveDir);
@ -98,7 +99,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
%
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', 'B (G)', ...
'FontName', options.font, ...
'FigNum', 6, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -108,7 +109,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
%
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', 'B (G)', ...
'FontName', options.font, ...
'FigNum', 7, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -3,15 +3,15 @@
% Specify data location to run analysis on
dataSources = {
struct('sequence', 'StructuralPhaseTransition', ...
'date', '2025/07/25', ...
'runs', [25]) % specify run numbers as a string in "" or just as a numeric value
'date', '2025/08/13', ...
'runs', [62]) % 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/202507';
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
options.measurementName = 'BECToDroplets';
scriptFullPath = mfilename('fullpath');
options.saveDirectory = fileparts(scriptFullPath);
@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -1,5 +1,5 @@
% --- User chooses which dataset to load ---
datasetIdx = 1; % <-- change this to 1, 2, 3, ...
datasetIdx = 4; % <-- change this to 1, 2, 3, ...
datasetName = sprintf('Dataset_%d', datasetIdx);
% Detect the folder where this script is located and set that as the Base Directory
@ -15,6 +15,7 @@ data = load(dataFile);
datasetStruct = data.(datasetName);
compiled_results = datasetStruct.results;
scan_parameter_values = datasetStruct.scan_parameter_values;
scan_reference_values = datasetStruct.scan_reference_values;
% Load the original options used during analysis
options = datasetStruct.options; % exact options used for this dataset

View File

@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -15,6 +15,7 @@ data = load(dataFile);
datasetStruct = data.(datasetName);
compiled_results = datasetStruct.results;
scan_parameter_values = datasetStruct.scan_parameter_values;
scan_reference_values = datasetStruct.scan_reference_values;
% Load the original options used during analysis
options = datasetStruct.options; % exact options used for this dataset
@ -86,8 +87,8 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'HighlightEvery', 10, ... % highlight every 10th repetition
'FontName', options.font, ...
'FigNum', 5, ...
'TileTitlePrefix', '\alpha', ... % user-defined tile prefix
'TileTitleSuffix', '^\circ', ... % user-defined suffix (e.g., Gauss symbol)...
'TileTitlePrefix', 'B', ... % user-defined tile prefix
'TileTitleSuffix', 'G', ... % user-defined suffix (e.g., Gauss symbol)...
'SkipSaveFigures', options.skipSaveFigures, ...
'SaveFileName', 'G2Curves.fig', ...
'SaveDirectory', figSaveDir);
@ -98,7 +99,7 @@ g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_r
%
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', 'B (G)', ...
'FontName', options.font, ...
'FigNum', 6, ...
'SkipSaveFigures', options.skipSaveFigures, ...
@ -108,7 +109,7 @@ Plotter.plotG2Features(g2_analysis_results, ...
%
Plotter.plotG2Cumulants(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
'XLabel', 'B (G)', ...
'FontName', options.font, ...
'FigNum', 7, ...
'SkipSaveFigures', options.skipSaveFigures, ...

View File

@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angles';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -3,15 +3,15 @@
% Specify data location to run analysis on
dataSources = {
struct('sequence', 'StructuralPhaseTransition', ...
'date', '2025/07/26', ...
'runs', [8]) % specify run numbers as a string in "" or just as a numeric value
'date', '2025/08/15', ...
'runs', [3]) % 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/202507';
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202508';
options.measurementName = 'BECToStripes';
scriptFullPath = mfilename('fullpath');
options.saveDirectory = fileparts(scriptFullPath);
@ -23,7 +23,7 @@ options.center = [1420, 2050];
options.span = [200, 200];
options.fraction = [0.1, 0.1];
options.pixel_size = 5.86e-6; % in meters
options.magnification = 23.94;
options.magnification = 24.6;
options.ImagingMode = 'HighIntensity';
options.PulseDuration = 5e-6; % in s
@ -52,7 +52,7 @@ options.skipMasking = true;
options.skipIntensityThresholding = true;
options.skipBinarization = true;
options.skipFullODImagesFolderUse = true;
options.skipFullODImagesFolderUse = false;
options.skipSaveData = false;
options.skipSaveFigures = true;
options.skipSaveProcessedOD = true;
@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -1,5 +1,5 @@
% --- User chooses which dataset to load ---
datasetIdx = 1; % <-- change this to 1, 2, 3, ...
datasetIdx = 6; % <-- change this to 1, 2, 3, ...
datasetName = sprintf('Dataset_%d', datasetIdx);
% Detect the folder where this script is located and set that as the Base Directory
@ -15,6 +15,7 @@ data = load(dataFile);
datasetStruct = data.(datasetName);
compiled_results = datasetStruct.results;
scan_parameter_values = datasetStruct.scan_parameter_values;
scan_reference_values = datasetStruct.scan_reference_values;
% Load the original options used during analysis
options = datasetStruct.options; % exact options used for this dataset
@ -77,6 +78,7 @@ Plotter.plotG2(compiled_results.full_g2_results.g2_mean, ...
'SaveFileName', 'G2ThetaAcrossTransition.fig', ...
'SaveDirectory', figSaveDir, ...
'Colormap', @Colormaps.coolwarm);
%% ------------------ 3. Feature extraction of g²(θ) across transition ------------------
Plotter.plotG2Curves(compiled_results.full_g2_results, ...
@ -92,10 +94,8 @@ Plotter.plotG2Curves(compiled_results.full_g2_results, ...
'SaveFileName', 'G2Curves.fig', ...
'SaveDirectory', figSaveDir);
%
g2_analysis_results = Analyzer.analyzeAutocorrelation(compiled_results.full_g2_results);
%
Plotter.plotG2Features(g2_analysis_results, ...
'Title', options.titleString, ...
'XLabel', '\alpha (deg)', ...
@ -153,8 +153,6 @@ Plotter.plotPCAResults(compiled_results.pca_results, scan_parameter_values, scan
'SkipSaveFigures', options.skipSaveFigures, ...
'SaveDirectory', figSaveDir);
%%
%{

View File

@ -2,16 +2,16 @@
% Specify data location to run analysis on
dataSources = {
struct('sequence', 'StructuralPhaseTransition', ...
'date', '2025/08/18', ...
'runs', [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 = 'F:/Data - Experiment/FullODImages/202508';
options.FullODImagesFolder = 'E:/Data - Experiment/FullODImages/202506';
options.measurementName = 'StripesToDroplets';
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
@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';

View File

@ -1,9 +1,9 @@
%% ===== BEC-Droplets-Stripes Settings =====
%% ===== BEC-Stripes-Droplets Settings =====
% Specify data location to run analysis on
dataSources = {
struct('sequence', 'StructuralPhaseTransition', ...
'date', '2025/08/18', ...
'date', '2025/08/16', ...
'runs', [8, 9, 10, 11, 12, 13]) % specify run numbers as a string in "" or just as a numeric value
};
@ -73,12 +73,12 @@ switch options.measurementName
options.scanParameterUnits = 'gauss';
options.titleString = 'BEC to Stripes';
case 'DropletsToStripes'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = true;
options.scanParameterUnits = 'degrees';
options.titleString = 'Droplets to Stripes';
case 'StripesToDroplets'
options.scan_parameter = 'ps_rot_mag_field';
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
options.flipSortOrder = false;
options.scanParameterUnits = 'degrees';
options.titleString = 'Stripes to Droplets';