start with 400G analysis work

This commit is contained in:
Silas Oettinghaus
2026-07-20 10:22:11 +02:00
parent cae81c0dae
commit 125d8508ca
43 changed files with 4089 additions and 123 deletions

View File

@@ -9,7 +9,7 @@ clear; clc;
studyName = "block_update_sweep";
selectedBlockUpdate = 1; % set [] to pool all block_update values
selectedPamLevels = 6; % set [] to use all PAM levels in the query result
selectedPamLevels = 4; % set [] to use all PAM levels in the query result
algorithmSelection = table( ...
["plain_ffe"; ...
@@ -17,7 +17,7 @@ algorithmSelection = table( ...
"a2_residual"; ...
"a1_moving_average"; ...
"dc_tracking"], ...
[true; true; true; true; true], ...
[true; false; false; false; true], ...
'VariableNames', ["algorithm", "enabled"]);
selectedAlgorithms = algorithmSelection.algorithm(algorithmSelection.enabled);
@@ -286,6 +286,81 @@ for regimeIdx = 1:numel(regimeNames)
% mat2tikz_improved("C:/Users/Silas/Documents/6971e0b65b380ca6d71c837f/04_Experimental_Evaluation/tikz/mpi/ber_vs_sir_" + regimeName + ".tikz","cleanfigure",1);
end
%% 4) Plot BER spread over SIR by delay/coherence regime and algorithm
spreadTable = berSpreadSummary(cleanData, groupVars);
fprintf("Calculated BER spread for %d regime/PAM/algorithm/SIR groups.\n", ...
height(spreadTable));
figure(); clf; hold on;
for regimeIdx = 1:numel(regimeNames)
regimeName = regimeNames(regimeIdx);
lineStyle = pathRegimeLineStyle(regimeName);
for algIdx = 1:numel(selectedAlgorithms)
algorithmName = selectedAlgorithms(algIdx);
algColor = algorithmColor(algorithmName);
marker = algorithmMarker(algorithmName, algorithmMarkers);
displayName = algorithmDisplayName(algorithmName);
curveMask = spreadTable.path_regime == regimeName & ...
spreadTable.algorithm == algorithmName;
if ~any(curveMask)
continue
end
curveTable = sortrows(spreadTable(curveMask, :), ...
["pam_level", "sir_exact"]);
for pamIdx = 1:numel(selectedPamLevels)
pamLevel = selectedPamLevels(pamIdx);
pamMask = curveTable.pam_level == pamLevel;
if ~any(pamMask)
continue
end
x = curveTable.sir_exact(pamMask).';
y = curveTable.std_log10_BER(pamMask).';
valid = isfinite(x) & isfinite(y);
if ~any(valid)
continue
end
if isscalar(selectedPamLevels)
legendText = sprintf("%s, %s", displayName, regimeName);
else
legendText = sprintf("%s, %s, PAM %.0f", ...
displayName, regimeName, pamLevel);
end
plot(x(valid), y(valid), ...
"LineStyle", lineStyle, ...
"Marker", marker, ...
"MarkerSize", 3.5, ...
"LineWidth", 1, ...
"Color", algColor, ...
"MarkerFaceColor", "w", ...
"MarkerEdgeColor", algColor, ...
"DisplayName", legendText);
end
end
end
xlabel("SIR (dB)");
ylabel("Std. dev. of log_{10}(BER)");
title("BER spread over SIR by delay regime and algorithm");
xlim([15, 45]);
grid on;
box on;
legend("Location", "northeast", "Interpreter", "none");
if exist("beautifyBERplot", "file")
beautifyBERplot("logscale", false, "setcolors", false, "setmarkers", false);
end
%% Local helpers
function values = numericColumn(values)
@@ -487,6 +562,38 @@ function yFit = fitLogBer(x, y, xFit, fitOrder)
yFit = 10 .^ polyval(coeff, xFit);
end
function spreadTable = berSpreadSummary(cleanData, groupVars)
summaryGroups = groupsummary(cleanData, groupVars);
sirExactTable = groupsummary(cleanData, groupVars, "median", "sir_exact");
summaryGroups = sortrows(summaryGroups, groupVars);
sirExactTable = sortrows(sirExactTable, groupVars);
summaryGroups.sir_exact = sirExactTable.median_sir_exact;
stdLogBer = NaN(height(summaryGroups), 1);
stdBer = NaN(height(summaryGroups), 1);
for groupIdx = 1:height(summaryGroups)
rowMask = true(height(cleanData), 1);
for varIdx = 1:numel(groupVars)
varName = groupVars(varIdx);
rowMask = rowMask & cleanData.(char(varName)) == ...
summaryGroups.(char(varName))(groupIdx);
end
berValues = cleanData.BER(rowMask);
berValues = berValues(isfinite(berValues) & berValues > 0);
if isempty(berValues)
continue
end
stdLogBer(groupIdx) = std(log10(berValues), 0, "omitnan");
stdBer(groupIdx) = std(berValues, 0, "omitnan");
end
spreadTable = summaryGroups;
spreadTable.std_log10_BER = stdLogBer;
spreadTable.std_BER = stdBer;
end
function label = algorithmDisplayName(algorithmName)
algorithmName = string(algorithmName);
switch algorithmName
@@ -532,3 +639,18 @@ function marker = algorithmMarker(algorithmName, algorithmMarkers)
end
marker = algorithmMarkers{mod(markerIdx - 1, numel(algorithmMarkers)) + 1};
end
function lineStyle = pathRegimeLineStyle(regimeName)
switch string(regimeName)
case "0-1 m"
lineStyle = "-";
case "10-100 m"
lineStyle = "--";
case "300 m"
lineStyle = ":";
case "1000 m"
lineStyle = "-.";
otherwise
lineStyle = "-";
end
end