206 lines
8.6 KiB
Matlab
206 lines
8.6 KiB
Matlab
%% ===== BEC-Droplets Settings =====
|
|
|
|
% Specify data location to run analysis on
|
|
dataSources = {
|
|
struct('sequence', 'StructuralPhaseTransition', ...
|
|
'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/202508';
|
|
options.measurementName = 'BECToDroplets';
|
|
scriptFullPath = mfilename('fullpath');
|
|
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.span = [200, 200];
|
|
options.fraction = [0.1, 0.1];
|
|
options.pixel_size = 5.86e-6; % in meters
|
|
options.magnification = 24.6;
|
|
options.ImagingMode = 'HighIntensity';
|
|
options.PulseDuration = 5e-6; % in s
|
|
|
|
% Fourier analysis settings
|
|
options.theta_min = deg2rad(0);
|
|
options.theta_max = deg2rad(180);
|
|
options.N_radial_bins = 500;
|
|
options.Radial_Sigma = 2;
|
|
options.Radial_WindowSize = 5; % odd number
|
|
|
|
options.k_min = 1.2771; % μm⁻¹
|
|
options.k_max = 2.5541; % μm⁻¹
|
|
options.N_angular_bins = 180;
|
|
options.Angular_Threshold = 75;
|
|
options.Angular_Sigma = 2;
|
|
options.Angular_WindowSize = 5;
|
|
options.zoom_size = 50;
|
|
|
|
% Flags
|
|
options.skipUnshuffling = false;
|
|
options.skipNormalization = false;
|
|
|
|
options.skipFringeRemoval = true;
|
|
options.skipPreprocessing = true;
|
|
options.skipMasking = true;
|
|
options.skipIntensityThresholding = true;
|
|
options.skipBinarization = true;
|
|
|
|
options.skipFullODImagesFolderUse = false;
|
|
options.skipSaveData = false;
|
|
options.skipSaveFigures = true;
|
|
options.skipSaveProcessedOD = true;
|
|
options.skipLivePlot = false;
|
|
options.showProgressBar = true;
|
|
|
|
% Extras
|
|
options.font = 'Bahnschrift';
|
|
switch options.measurementName
|
|
case 'BECToDroplets'
|
|
options.scan_parameter = 'rot_mag_field';
|
|
options.flipSortOrder = true;
|
|
options.scanParameterUnits = 'gauss';
|
|
options.titleString = 'BEC to Droplets';
|
|
case 'BECToStripes'
|
|
options.scan_parameter = 'rot_mag_field';
|
|
options.flipSortOrder = true;
|
|
options.scanParameterUnits = 'gauss';
|
|
options.titleString = 'BEC to Stripes';
|
|
case 'DropletsToStripes'
|
|
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
|
options.flipSortOrder = false;
|
|
options.scanParameterUnits = 'degrees';
|
|
options.titleString = 'Droplets to Stripes';
|
|
case 'StripesToDroplets'
|
|
options.scan_parameter = 'ps_rot_mag_fin_pol_angle';
|
|
options.flipSortOrder = false;
|
|
options.scanParameterUnits = 'degrees';
|
|
options.titleString = 'Stripes to Droplets';
|
|
end
|
|
|
|
%% ===== Collect Images and Launch Viewer =====
|
|
|
|
[options.selectedPath, options.folderPath] = Helper.selectDataSourcePath(dataSources, options);
|
|
|
|
[od_imgs, scan_parameter_values, scan_reference_values, file_list] = Helper.collectODImages(options);
|
|
|
|
%% Conduct spectral analysis
|
|
spectral_analysis_results = Analyzer.extractFullRadialSpectralDistribution(od_imgs, options);
|
|
|
|
%% ------------------ 1. Plot of all Radial Spectral Distribution Curves ------------------
|
|
Plotter.plotSpectralCurves( ...
|
|
spectral_analysis_results.S_k_all, ...
|
|
spectral_analysis_results.k_rho_vals, ...
|
|
scan_reference_values, ... % correct scan params
|
|
'Title', options.titleString, ...
|
|
'XLabel', 'k_\rho', ...
|
|
'YLabel', 'S(k_\rho)', ...
|
|
'YScale', 'log', ...
|
|
'XLim', [min(spectral_analysis_results.k_rho_vals), max(spectral_analysis_results.k_rho_vals)], ...
|
|
'HighlightEvery', 10, ... % highlight every 10th repetition
|
|
'FontName', options.font, ...
|
|
'FigNum', 1, ...
|
|
'TileTitlePrefix', 'B', ... % user-defined tile prefix
|
|
'TileTitleSuffix', 'G', ... % user-defined suffix (e.g., degrees symbol)
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveFileName', 'SpectralCurves.fig', ...
|
|
'SaveDirectory', options.saveDirectory);
|
|
|
|
%% ------------------ 2. Fit truncated Radial Spectral Distribution Curves ------------------
|
|
[fitResults, rawCurves] = Analyzer.fitTwoGaussianCurvesToRadialSpectralDistribution(...
|
|
spectral_analysis_results.S_k_all, ... % radial spectral curves
|
|
spectral_analysis_results.k_rho_vals, ... % corresponding k_rho values
|
|
'KRhoRange', [0, 3], ... % truncate curves to 0 <= k_rho <= 3
|
|
'AmplitudeRange', [0, 0.3], ... % truncate curves to y >= 0 (all amplitudes)
|
|
'ResidualThreshold', 0.15, ... % maximum allowed residual
|
|
'PositionThreshold', 0.5, ... % minimum separation between peaks
|
|
'AmplitudeThreshold', 0.015); % minimum secondary peak fraction
|
|
|
|
%% ------------------ Plot Fits on Raw ------------------
|
|
options.skipLivePlot = true;
|
|
options.skipSaveFigures = false;
|
|
Plotter.plotTwoModeGaussianFitsOnRaw(fitResults, rawCurves, 4, 6, ...
|
|
'SkipLivePlot', options.skipLivePlot, ...
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveDirectory', options.saveDirectory);
|
|
|
|
%% ------------------ Interactive Fit Viewer ------------------
|
|
Analyzer.runInteractiveRSDTwoGaussianFitGUI(spectral_analysis_results);
|
|
|
|
%% ------------------ 3. Plot fit parameters - amplitude ------------------
|
|
Plotter.plotFitParameterPDF(fitResults, scan_reference_values, 'A2', ...
|
|
'Title', options.titleString, ...
|
|
'XLabel', 'B (G)', ...
|
|
'YLabel', 'Secondary peak amplitude', ...
|
|
'FontName', options.font, ...
|
|
'FontSize', 16, ...
|
|
'FigNum', 4, ...
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveFileName', 'SecondaryPeakAmplitudePDF.fig', ...
|
|
'SaveDirectory', options.saveDirectory, ...
|
|
'PlotType', 'histogram', ...
|
|
'NumberOfBins', 20, ...
|
|
'NormalizeHistogram', true, ...
|
|
'Colormap', @Colormaps.coolwarm, ...
|
|
'XLim', [min(scan_reference_values), max(scan_reference_values)], ...
|
|
'YLim', [0, 0.025]);
|
|
|
|
%% ------------------ 4. Plot fit parameters - position ------------------
|
|
Plotter.plotFitParameterPDF(fitResults, scan_reference_values, 'mu2', ...
|
|
'Title', options.titleString, ...
|
|
'XLabel', 'B (G)', ...
|
|
'YLabel', 'Secondary peak position (\theta, rad)', ...
|
|
'FontName', options.font, ...
|
|
'FontSize', 16, ...
|
|
'FigNum', 5, ...
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveFileName', 'SecondaryPeakPositionPDF.fig', ...
|
|
'SaveDirectory', options.saveDirectory, ...
|
|
'PlotType', 'histogram', ...
|
|
'NumberOfBins', 20, ...
|
|
'NormalizeHistogram', true, ...
|
|
'Colormap', @Colormaps.coolwarm, ...
|
|
'XLim', [min(scan_reference_values), max(scan_reference_values)], ...
|
|
'YLim', [0, 3]);
|
|
%% ------------------ 5. Plot fit parameters - width ------------------
|
|
Plotter.plotFitParameterPDF(fitResults, scan_reference_values, 'sigma2', ...
|
|
'Title', options.titleString, ...
|
|
'XLabel', 'B (G)', ...
|
|
'YLabel', 'Secondary peak width (\sigma, rad)', ...
|
|
'FontName', options.font, ...
|
|
'FontSize', 16, ...
|
|
'FigNum', 6, ...
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveFileName', 'SecondaryPeakWidthPDF.fig', ...
|
|
'SaveDirectory', options.saveDirectory, ...
|
|
'PlotType', 'histogram', ...
|
|
'NumberOfBins', 20, ...
|
|
'NormalizeHistogram', true, ...
|
|
'Colormap', @Colormaps.coolwarm, ...
|
|
'XLim', [min(scan_reference_values), max(scan_reference_values)], ...
|
|
'YLim', [0, 1.5]);
|
|
|
|
%% ------------------ 6. Plot secondary Gaussian range ------------------
|
|
Plotter.plotSecondaryGaussianRange(fitResults, scan_reference_values, ...
|
|
'Title', options.titleString, ...
|
|
'XLabel', 'B (G)', ...
|
|
'YLabel', '\mu_2 \pm \sigma_2 (rad)', ...
|
|
'FontName', options.font, ...
|
|
'FontSize', 16, ...
|
|
'FigNum', 8, ...
|
|
'NumberOfBins', 20, ...
|
|
'NormalizeHistogram', true, ...
|
|
'Colormap', @Colormaps.coolwarm, ...
|
|
'OverlayMeanSEM', true, ...
|
|
'SkipSaveFigures', options.skipSaveFigures, ...
|
|
'SaveFileName', 'SecondaryGaussianRange.fig', ...
|
|
'SaveDirectory', options.saveDirectory);
|
|
|
|
|