new general processing structure just before splitting off the projects folder from this repo
117 lines
4.4 KiB
Matlab
117 lines
4.4 KiB
Matlab
% === SETTINGS ===
|
|
|
|
dsp_options.append_to_db = 1;
|
|
dsp_options.max_occurences = 15;
|
|
dsp_options.database_path = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
|
dsp_options.database_name = 'silas_labor_newdsp_newstructure.db';
|
|
dsp_options.storage_path = 'Z:\2024\sioe_labor\';
|
|
dsp_options.parameters = struct();
|
|
dsp_options.parameters.mu_dc = [0.005];
|
|
|
|
% === Get Run ID's ===
|
|
db = DBHandler("pathToDB", [dsp_options.database_path, dsp_options.database_name], "type", "sqlite");
|
|
fp = QueryFilter();
|
|
% fp.where('Runs', 'run_id','EQUALS', 5108);
|
|
fp.where('Runs', 'is_mpi','EQUALS', 0);
|
|
% fp.where('Runs', 'fiber_length','EQUALS', 10);
|
|
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
|
fp.where('Runs', 'db_mode','EQUALS', 1);
|
|
fp.where('Runs', 'rop_attenuation','EQUALS', 0);
|
|
fp.where('Runs', 'pam_level','EQUALS', 4);
|
|
% fp.where('Runs', 'bitrate','EQUALS', 360e9);
|
|
% fp.where('Runs', 'power_pd_in','GREATER_THAN', 7);
|
|
[dataTable,~] = db.queryDB(fp, db.getTableFieldNames('Runs'));
|
|
|
|
% === Initialize DataStorage ===
|
|
wh = DataStorage(dsp_options.parameters);
|
|
wh.addStorage("ffe_package");
|
|
wh.addStorage("mlse_package");
|
|
wh.addStorage("vnle_package");
|
|
wh.addStorage("dbtgt_package");
|
|
wh.addStorage("dbenc_package");
|
|
|
|
% === RUN IT ===
|
|
|
|
% [results,wh] = submitJobs(dataTable.run_id(:), dsp_options, "parallel", 'wh', wh, 'waitbar', true);
|
|
% wh.getStoValue('ffe_package',0.005);
|
|
% wh.getStoValue('mlse_package',0.005);
|
|
|
|
[dataTable,~] = db.queryDB(fp, [db.getTableFieldNames('Runs');db.getTableFieldNames('Results');db.getTableFieldNames('Equalizer')]);
|
|
|
|
dataTable = cleanUpTable(dataTable);
|
|
|
|
% === Look at it ===
|
|
y_var = 'BER_precoded';
|
|
x_var = 'bitrate';
|
|
fixedVars = {'equalizer_structure', x_var};
|
|
|
|
[dataTableClean, outliersTable] = removeGroupOutliers(dataTable, fixedVars, y_var);
|
|
|
|
% --- Group and aggregate ---
|
|
dataTableGrpd_mean = groupIt(fixedVars, dataTableClean, @mean);
|
|
dataTableGrpd_min = groupIt(fixedVars, dataTableClean, @min);
|
|
dataTableGrpd_max = groupIt(fixedVars, dataTableClean, @max);
|
|
|
|
% Choose a color map
|
|
cols = linspecer(numel(unique(dataTableGrpd_mean.equalizer_structure)));
|
|
|
|
figure;
|
|
hold on;
|
|
|
|
% Get unique equalizer structures for grouping
|
|
unique_eq = unique(dataTableGrpd_mean.equalizer_structure);
|
|
|
|
for i = 1:numel(unique_eq)
|
|
eq_val = unique_eq(i);
|
|
|
|
% Filter grouped data for this equalizer structure
|
|
filt = dataTableGrpd_mean.equalizer_structure == eq_val;
|
|
|
|
x = dataTableGrpd_mean.(x_var)(filt);
|
|
y_mean = dataTableGrpd_mean.(y_var)(filt);
|
|
y_min = dataTableGrpd_min.(y_var)(filt);
|
|
y_max = dataTableGrpd_max.(y_var)(filt);
|
|
|
|
% Bounds for boundedline (distance from mean)
|
|
y_lower = y_mean - y_min;
|
|
y_upper = y_max - y_mean;
|
|
y_bounds = [y_lower, y_upper];
|
|
|
|
% --- Bounded line (mean ± min/max) ---
|
|
if exist('boundedline', 'file')
|
|
[hl, hp] = boundedline(x, y_mean, y_bounds, ...
|
|
'alpha', 'transparency', 0.1, ...
|
|
'cmap', cols(i,:), ...
|
|
'nan', 'fill', ...
|
|
'orientation', 'vert');
|
|
set(hl, 'LineWidth', 1.2, 'DisplayName', sprintf('Eq %s', eq_val));
|
|
set(hp, 'HandleVisibility', 'off');
|
|
else
|
|
% If boundedline is not available, use errorbar
|
|
errorbar(x, y_mean, y_lower, y_upper, ...
|
|
'o-', 'Color', cols(i,:), 'LineWidth', 1.2, ...
|
|
'DisplayName', sprintf('Eq %d', eq_val),'HandleVisibility', 'off');
|
|
end
|
|
|
|
% --- Normal line (mean only) ---
|
|
plot(x, y_mean, '-', 'Color', cols(i,:), 'LineWidth', 1.5, ...
|
|
'DisplayName', sprintf('Mean Eq %s', eq_val),'HandleVisibility', 'off');
|
|
|
|
% --- Scatter plot for individual points (from original data) ---
|
|
% Filter original data for this group
|
|
orig_filt = dataTableClean.equalizer_structure == eq_val;
|
|
x_scatter = dataTableClean.(x_var)(orig_filt);
|
|
y_scatter = dataTableClean.(y_var)(orig_filt);
|
|
|
|
scatter(x_scatter, y_scatter, 10,cols(i,:), 'filled', ...
|
|
'MarkerFaceAlpha', 0.5, 'DisplayName', sprintf('Scatter Eq %s', eq_val),'HandleVisibility', 'off');
|
|
end
|
|
|
|
yline([2.2e-4,4.85e-3,2e-2],'HandleVisibility', 'off','LineWidth',1,'LineStyle','--');
|
|
set(gca, 'YScale', 'log'); % BER is usually plotted log-scale
|
|
xlabel(x_var, 'Interpreter', 'none');
|
|
ylabel(y_var, 'Interpreter', 'none');
|
|
legend('show', 'Location', 'best');
|
|
grid on;
|
|
title(sprintf('%s vs. %s', y_var, x_var), 'Interpreter', 'none');
|
|
hold off; |