more and more

This commit is contained in:
Silas Oettinghaus
2026-07-08 21:36:08 +02:00
parent 699d146fb5
commit 1879441999
22 changed files with 2197 additions and 174 deletions

View File

@@ -3,9 +3,9 @@ dsp_options = struct();
dsp_options.mode = "run_id";
dsp_options.recipe = @mpi_recipe_dev;
dsp_options.append_to_db = false;
dsp_options.max_occurences = 3;
dsp_options.start_occurence = 1;
dsp_options.debug_plots = true;
dsp_options.max_occurences = 10;
dsp_options.debug_plots = false;
dsp_options.database_type = "mysql";
@@ -24,21 +24,21 @@ db = DBHandler("dataBase", [dsp_options.dataBase],...
%%
fp = QueryFilter();
fp.where('Runs','run_id','GREATER_EQUAL',3153);
fp.where('Runs', 'symbolrate', 'EQUALS', 112e9);
fp.where('Runs', 'fiber_length', 'EQUALS', 0);
fp.where('Runs', 'interference_path_length', 'EQUALS', 1000);
fp.where('Runs', 'sir', 'EQUALS', 23);
% fp.where('Runs', 'db_mode', 'EQUALS', '"no_db"');
fp.where('Runs', 'sir', 'LESS_EQUAL', 30);
fp.where('Runs', 'db_mode', 'EQUALS', '"no_db"');
% fp.where('Runs', 'is_mpi', 'EQUALS', 1);
fp.where('Runs', 'pam_level', 'EQUALS', 4);
fp.where('Runs', 'wavelength', 'EQUALS', 1310);
fp.where('Runs', 'v_bias', 'EQUALS', 2.65);
% fp.where('Runs', 'v_bias', 'EQUALS', 2.65);
[dataTable,~] = db.queryDB(fp, db.getTableFieldNames('Runs'));
[~, uniqueSirRows] = unique(dataTable.sir, "stable");
dataTable = dataTable(uniqueSirRows, :);
% sort rows by sir (ascending) and extract run_ids
% [~, uniqueSirRows] = unique(dataTable.sir, "stable");
% dataTable = dataTable(uniqueSirRows, :);
[~, sortIdx] = sort(dataTable.sir, 'descend');
dataTable = dataTable(sortIdx, :);
run_ids = dataTable.run_id;
@@ -50,27 +50,55 @@ end
%% === Warehouse setup ===
dsp_options.userParameters = struct();
dsp_options.userParameters.smoothing_length = logspace(1,5.5,5);
% dsp_options.userParameters.smoothing_length = [0,linspace(100,1000,10),2500,5000,10000];
wh = DataStorage(dsp_options.userParameters);
%%
n_realizations = (dsp_options.max_occurences - dsp_options.start_occurence + 1);
n_userparams = prod(wh.dim);
n_run_ids = numel(run_ids);
parallel_jobs = n_userparams * n_run_ids;
queried_jobs = n_realizations * n_userparams * n_run_ids;
fprintf("-> [ %d run_id(s) × %d userParam combination(s) = %d parallel job(s) ] × %d realizations = %d total jobs \n", ...
n_run_ids, n_userparams, parallel_jobs, n_realizations, queried_jobs);
%% === Run ===
% submitJobs returns the raw per-job results and the filled Warehouse. For a
% single run_id and remove_dc = [0, 1], results is a 2-by-1 cell array.
[results, wh] = submitJobs(run_ids, dsp_options, processingMode.parallel, ...
[results, wh] = submitJobs(run_ids, dsp_options, processingMode.serial, ...
"wh", wh, ...
"waitbar", true);
%% Analyze
storageNames = fieldnames(wh.sto);
x_vars = dsp_options.userParameters.smoothing_length;
x_vars = run_ids;%dsp_options.userParameters.smoothing_length;
x_vars = reshape(x_vars,1,[]);
figure(2026);hold on
for i = 1:numel(run_ids)
disp(run_ids(i))
result = wh.getStoValue(storageNames{1},x_vars);
ber = cellfun(@(packageCell) packageCell{1}.metrics.BER, result);
plot(x_vars,ber);
beautifyBERplot("logscale",true,"setcolors",true,"setmarkers",true);
result = wh.getStoValue(storageNames{1}, x_vars);
% Each cell in result is a cell array (packageCell) containing multiple packages.
% Extract BERs from all packages and, for example, average them per x_var.
ber_all = cellfun(@(packageCell) cellfun(@(pkg) pkg.metrics.BER, packageCell), result, 'UniformOutput', false);
% Convert to numeric matrix (rows = packages, cols = x_vars) by padding if needed
maxPackages = max(cellfun(@numel, ber_all));
ber_mat = nan(maxPackages, numel(ber_all));
for k = 1:numel(ber_all)
ber_mat(1:numel(ber_all{k}), k) = ber_all{k};
end
% Choose aggregation: mean across packages (ignore NaNs)
ber = mean(ber_mat, 1, 'omitnan');
x = dataTable.sir;
y = ber;
plot(x,ber);
scatter(x,ber_mat)
beautifyBERplot("logscale",true,"setcolors",false,"setmarkers",true);
end