More bugfixes
This commit is contained in:
parent
7d196f4bb0
commit
369a0da75d
@ -123,8 +123,8 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
|
||||
% If user forces recompute -> recompute from selected raw path
|
||||
if isfield(options,'skipFullODImagesFolderUse') && options.skipFullODImagesFolderUse
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list, full_od_image_subfolder, nFiles] = ...
|
||||
recomputeODImages(options, dataSource, selPath);
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list] = ...
|
||||
recomputeODImages(options, selPath);
|
||||
matched = true;
|
||||
|
||||
else
|
||||
@ -152,8 +152,8 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
|
||||
% If no matching full-OD folder found, recompute from the selected raw path
|
||||
if ~found
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list, full_od_image_subfolder, nFiles] = ...
|
||||
recomputeODImages(options, dataSource, selPath);
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list] = ...
|
||||
recomputeODImages(options, selPath);
|
||||
matched = true;
|
||||
end
|
||||
end
|
||||
@ -163,8 +163,8 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
% --- No selectedPath provided: either force recompute or search among fullodimage_folders ---
|
||||
if isfield(options,'skipFullODImagesFolderUse') && options.skipFullODImagesFolderUse
|
||||
% forced recompute
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list, full_od_image_subfolder, nFiles] = ...
|
||||
recomputeODImages(options, dataSource);
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list] = ...
|
||||
recomputeODImages(options, options.baseDataFolder);
|
||||
matched = true;
|
||||
|
||||
else
|
||||
@ -194,17 +194,17 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
% --- If still not matched, recompute from raw (fallback) ---
|
||||
if ~matched
|
||||
if isempty(full_od_image_parent_folder) && ~useFullODFolders
|
||||
fprintf('\n[INFO] No full OD images found in workspace or on disk. Computing from raw...\n');
|
||||
fprintf('\n[INFO] No full OD images found in workspace or on disk. Computing from raw data...\n');
|
||||
else
|
||||
fprintf('\n[INFO] No matching full OD images subfolder found. Recomputing from raw...\n');
|
||||
fprintf('\n[INFO] No matching full OD images subfolder found. Recomputing from raw data...\n');
|
||||
end
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list, full_od_image_subfolder, nFiles] = ...
|
||||
recomputeODImages(options, dataSource);
|
||||
recomputeODImages(options, options.baseDataFolder);
|
||||
end
|
||||
|
||||
% --- If a folder was determined, load its contents (listing) ---
|
||||
if ~isempty(full_od_image_subfolder) && useFullODFolders
|
||||
[raw_scan_parameter_values, raw_file_list, nFiles] = prepareDiskListing(full_od_image_subfolder);
|
||||
[mat_files, raw_scan_parameter_values, raw_file_list, nFiles] = prepareData(full_od_image_subfolder);
|
||||
fprintf('\n[INFO] Cropping and subtracting background from images in full OD images folder on disk...\n');
|
||||
end
|
||||
end
|
||||
@ -225,11 +225,11 @@ function [od_imgs, scan_parameter_values, file_list] = collectODImages(options)
|
||||
od_mat = full_od_imgs(:,:,k);
|
||||
bkg_mat = full_bkg_imgs(:,:,k);
|
||||
else
|
||||
data = load(fullfile(full_od_image_subfolder, mat_files(k).name));
|
||||
od_mat = data.OD;
|
||||
bkg_mat = data.BKG;
|
||||
data = load(fullfile(full_od_image_subfolder, mat_files(k).name));
|
||||
od_mat = data.OD;
|
||||
bkg_mat = data.BKG;
|
||||
raw_scan_parameter_values(k) = data.Scan;
|
||||
raw_file_list(k) = data.File;
|
||||
raw_file_list(k) = data.File;
|
||||
end
|
||||
else
|
||||
od_mat = full_od_imgs(:,:,k);
|
||||
@ -441,7 +441,7 @@ function dataSource = makeDataSourceStruct(folderPath)
|
||||
};
|
||||
end
|
||||
|
||||
function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list, fullodimage_folder, nFiles] = recomputeODImages(options, dataSource, selectedPath)
|
||||
function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list] = recomputeODImages(options, selectedPath)
|
||||
% recomputeODImages: central recompute routine
|
||||
% optional argument selectedPath (if provided) will be used as options.folderPath for processing
|
||||
|
||||
@ -449,8 +449,6 @@ function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list,
|
||||
selectedPath = '';
|
||||
end
|
||||
|
||||
fprintf('\n[INFO] Computing OD images from raw data...\n');
|
||||
|
||||
% make a local copy of options so we can override folderPath if selectedPath supplied
|
||||
opts = options;
|
||||
if ~isempty(selectedPath)
|
||||
@ -461,20 +459,11 @@ function [full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list,
|
||||
[full_od_imgs, full_bkg_imgs, raw_scan_parameter_values, raw_file_list] = Helper.processRawData(opts);
|
||||
|
||||
if opts.SAVE_TO_WORKSPACE
|
||||
nFiles = size(full_od_imgs,3);
|
||||
assignin('base','full_od_imgs',full_od_imgs);
|
||||
assignin('base','full_bkg_imgs',full_bkg_imgs);
|
||||
assignin('base','raw_scan_parameter_values',raw_scan_parameter_values);
|
||||
assignin('base','raw_file_list',raw_file_list);
|
||||
fullodimage_folder = [];
|
||||
fprintf('\n[INFO] Completed computing OD images. Stored in workspace for reuse.\n');
|
||||
fprintf('\n[INFO] Cropping and subtracting background from images...\n');
|
||||
else
|
||||
% Use dataSource to construct a run-folder (keeps naming consistent)
|
||||
fullodimage_folder = createRunFolder(options, dataSource);
|
||||
[raw_scan_parameter_values, raw_file_list, nFiles] = prepareDiskListing(fullodimage_folder);
|
||||
fprintf('\n[INFO] Completed computing OD images. Stored on disk for reuse.\n');
|
||||
end
|
||||
fprintf('\n[INFO] Cropping and subtracting background from images...\n');
|
||||
end
|
||||
|
||||
function fullodimage_folder = createRunFolder(options, dataSource)
|
||||
@ -485,7 +474,7 @@ function fullodimage_folder = createRunFolder(options, dataSource)
|
||||
fullodimage_folder = fullfile(options.saveDirectory, ['FullODImages_' runID]);
|
||||
end
|
||||
|
||||
function [raw_scan_parameter_values, raw_file_list, nFiles] = prepareDiskListing(folder)
|
||||
function [mat_files, raw_scan_parameter_values, raw_file_list, nFiles] = prepareData(folder)
|
||||
mat_files = dir(fullfile(folder,'*.mat'));
|
||||
mat_files = mat_files(~strcmp({mat_files.name},'metadata.mat')); % exclude metadata
|
||||
nFiles = numel(mat_files);
|
||||
|
||||
@ -65,10 +65,10 @@ function [SAVE_TO_WORKSPACE, runMemoryGB] = estimateDatasetMemory(dataSources, o
|
||||
|
||||
if runBytes > 0.75 * availableRAM
|
||||
SAVE_TO_WORKSPACE = false;
|
||||
fprintf('[INFO] Run %s/%s estimated size %.2f GB exceeds 75%% of available RAM. Saving to disk.\n', ...
|
||||
fprintf('\n[INFO] Run %s/%s estimated size %.2f GB exceeds 75%% of available RAM. Saving to disk.\n', ...
|
||||
ds.sequence, runID, runBytes/1e9);
|
||||
else
|
||||
fprintf('[INFO] Run %s/%s estimated size %.2f GB fits in memory.\n', ...
|
||||
fprintf('\n[INFO] Run %s/%s estimated size %.2f GB fits in memory.\n', ...
|
||||
ds.sequence, runID, runBytes/1e9);
|
||||
end
|
||||
end
|
||||
|
||||
@ -44,12 +44,12 @@ function [selectedPath, folderPath] = selectDataSourcePath(dataSources, options)
|
||||
if ~isfield(options,'skipFullODImagesFolderUse') || ~options.skipFullODImagesFolderUse
|
||||
fprintf('\n[INFO] Both raw data folder (%s) and full OD Images folder (%s) found.\n', ...
|
||||
options.baseDataFolder, full_od_image_parent_folder);
|
||||
fprintf('[INFO] Prioritizing full OD Images folder (set skipFullODImagesFolderUse=true to override).\n');
|
||||
fprintf('\n[INFO] Prioritizing full OD Images folder (set skipFullODImagesFolderUse=true to override).\n');
|
||||
useFullOD = true;
|
||||
else
|
||||
fprintf('\n[INFO] Both raw data folder (%s) and full OD Images folder (%s) found.\n', ...
|
||||
options.baseDataFolder, full_od_image_parent_folder);
|
||||
fprintf('[INFO] Prioritizing raw data folder (set skipFullODImagesFolderUse=false to override).\n');
|
||||
fprintf('\n[INFO] Prioritizing raw data folder (set skipFullODImagesFolderUse=false to override).\n');
|
||||
end
|
||||
else
|
||||
fprintf('[INFO] Using raw data folder(s) since full OD images not found or not specified.\n');
|
||||
|
||||
@ -3,15 +3,15 @@
|
||||
% 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
|
||||
'date', '2025/08/26', ...
|
||||
'runs', [6, 7, 8, 9, 10, 11]) % 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 = 'D:/Data - Experiment/FullODImages/202508';
|
||||
options.measurementName = 'DropletsToStripes';
|
||||
scriptFullPath = mfilename('fullpath');
|
||||
options.saveDirectory = fileparts(scriptFullPath);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user