Stuff during JLT writing...
This commit is contained in:
@@ -0,0 +1,223 @@
|
||||
|
||||
|
||||
database_type = 'mysql';
|
||||
dataBase = 'labor_highspeed';
|
||||
db = DBHandler("dataBase", [dataBase], "type", database_type);
|
||||
|
||||
|
||||
% M = 4;
|
||||
fp = QueryFilter();
|
||||
% fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','LESS_THAN', 1312);
|
||||
% fp.where('Runs', 'db_mode','EQUALS', 1); % 0 == high preemphasis // 1 == low preemphasis
|
||||
fp.where('Runs', 'rop_attenuation','EQUALS', 0);
|
||||
|
||||
fields = db.getTableFieldNames('power_state_info');
|
||||
fields = [fields; db.getTableFieldNames('dashboard_ungrouped_alltime')]; %dashboard_ungrouped_after_nov_2025 dashboard_ungrouped_aug_nov_2025
|
||||
[dataTable,~] = db.queryDB(fp, fields);
|
||||
|
||||
%%
|
||||
cfg = struct;
|
||||
cfg.x_axis = 'grossrate'; % 'symbol rate' | 'bitrate' | 'wavelength' grossrate
|
||||
cfg.y_axis = 'BER'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
|
||||
cfg.y_scale = 'auto'; % auto -> log for BER*, linear otherwise
|
||||
cfg.outlier = 'mad'; % simple, robust; 'none' or 'pctl' also available
|
||||
cfg.show_raw = false;
|
||||
cfg.show_spread = 'none'; % 'none' or 'iqr' or minmax
|
||||
cfg.agg = 'min'; % or 'median'
|
||||
cfg.show_precoded = 0;
|
||||
|
||||
% cfg.fec_lines = [2.2e-4 4.85e-3 2e-2]; % optional
|
||||
cfg.fec_lines = [];
|
||||
cfg.plot.custom_colors = [
|
||||
clr.Paired.red;
|
||||
clr.Paired.blue;
|
||||
clr.Paired.green;
|
||||
clr.Paired.orange;
|
||||
clr.Paired.purple
|
||||
];
|
||||
|
||||
cfg.plot.custom_colors_scatter = [
|
||||
clr.Paired.lightred;
|
||||
clr.Paired.lightblue;
|
||||
clr.Paired.lightgreen;
|
||||
clr.Paired.lightorange;
|
||||
clr.Paired.lightpurple
|
||||
];
|
||||
|
||||
|
||||
% New styling knobs
|
||||
cfg.plot.use_cbrewer2 = true;
|
||||
cfg.plot.colormap = 'Paired';
|
||||
cfg.plot.paired_dark_first = false; % dark for lines, light for scatter
|
||||
cfg.plot.lineWidth = 2.0;
|
||||
cfg.plot.errWidth = 1.2;
|
||||
cfg.plot.scatterAlpha = 0.35;
|
||||
cfg.plot.legendLocation = 'best';
|
||||
cfg.plot.fecLineWidth = 2.4; % thicker FEC limits
|
||||
cfg.plot.lineStyle_pre_emph_on = '-';
|
||||
cfg.plot.lineStyle_pre_emph_off = '-';
|
||||
|
||||
%% PLOT NGMI
|
||||
|
||||
% Common cfg
|
||||
cfg.show_precoded = 1;
|
||||
cfg.group_by = {'equalizer_structure','pre_emph'};
|
||||
cfg.x_axis = 'grossrate';
|
||||
cfg.y_axis = 'NGMI'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
cfg.y_scale = 'lin';
|
||||
cfg.plot.custom_colors_scatter = [];
|
||||
cfg.plot.use_cbrewer2 = false;
|
||||
cfg.fec_lines = [];
|
||||
cfg.agg = 'max';
|
||||
|
||||
cfg.figure_number = 45;
|
||||
% fig = figure(cfg.figure_number);
|
||||
|
||||
lambda = 1310;
|
||||
% PAM 4
|
||||
cfg.plot.custom_colors = clr.Paired.red;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',4, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_db_mlse, ...
|
||||
'pre_emph',0,'wavelength',lambda);
|
||||
cfg.show_precoded = 1;
|
||||
a = plot_measurements_gpt(dataTable, cfg);
|
||||
ngmi_pam4 = a.lines(1).YData;
|
||||
tp = TransmissionPerformance;
|
||||
netrates_vnle = tp.calculateNetRate(baudrate.* m, ...
|
||||
'NGMI', ngmi_pam4, ...
|
||||
'BER', BER_VNLE);
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.red;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',4, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_db_mlse, ...
|
||||
'pre_emph',0,'wavelength',1293);
|
||||
cfg.show_precoded = 1;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% PAM 6
|
||||
cfg.plot.custom_colors = clr.Paired.blue;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',6, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',lambda);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.blue;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',6, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',1293);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% PAM 8
|
||||
cfg.plot.custom_colors = clr.Paired.green;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',8, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',lambda);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.green;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',8, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',1293);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
beautifyBERplot
|
||||
ylim([0.87,1.01]);
|
||||
% xlim([290,480]);
|
||||
|
||||
%% PLOT AIR
|
||||
|
||||
% Common cfg
|
||||
cfg.show_precoded = 1;
|
||||
cfg.group_by = {'equalizer_structure','pre_emph'};
|
||||
cfg.x_axis = 'grossrate';
|
||||
cfg.y_axis = 'AIR'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
cfg.y_scale = 'lin';
|
||||
cfg.plot.custom_colors_scatter = [];
|
||||
cfg.plot.use_cbrewer2 = false;
|
||||
cfg.fec_lines = [];
|
||||
cfg.agg = 'max';
|
||||
|
||||
cfg.figure_number = 47;
|
||||
% fig = figure(cfg.figure_number);
|
||||
|
||||
lambda = 1310;
|
||||
|
||||
% PAM 4
|
||||
cfg.plot.custom_colors = clr.Paired.red;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',4, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_db_mlse, ...
|
||||
'pre_emph',0,'wavelength',lambda);
|
||||
cfg.show_precoded = 1;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.red;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',4, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_db_mlse, ...
|
||||
'pre_emph',0,'wavelength',1293);
|
||||
cfg.show_precoded = 1;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% PAM 6
|
||||
cfg.plot.custom_colors = clr.Paired.blue;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',6, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',lambda);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.blue;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',6, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',1293);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% PAM 8
|
||||
cfg.plot.custom_colors = clr.Paired.green;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',8, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',lambda);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
cfg.plot.custom_colors = clr.Paired.green;
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',8, ...
|
||||
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
|
||||
'pre_emph',1,'wavelength',1293);
|
||||
cfg.show_precoded = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
ax = gca;
|
||||
|
||||
beautifyBERplot
|
||||
|
||||
ylim([275,435]);
|
||||
xlim([290,480]);
|
||||
|
||||
|
||||
%%
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
database_type = 'mysql';
|
||||
dataBase = 'labor_highspeed';
|
||||
db = DBHandler("dataBase", [dataBase], "type", database_type);
|
||||
|
||||
|
||||
% M = 4;
|
||||
fp = QueryFilter();
|
||||
% fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
||||
% fp.where('Runs', 'db_mode','EQUALS', 1); % 0 == high preemphasis // 1 == low preemphasis
|
||||
fp.where('Runs', 'rop_attenuation','EQUALS', 0);
|
||||
|
||||
fields = db.getTableFieldNames('power_state_info');
|
||||
fields = [fields; db.getTableFieldNames('dashboard_ungrouped_alltime')]; %dashboard_ungrouped_after_nov_2025 dashboard_ungrouped_aug_nov_2025
|
||||
[dataTable,~] = db.queryDB(fp, fields);
|
||||
|
||||
%%
|
||||
cfg = struct;
|
||||
cfg.x_axis = 'grossrate'; % 'symbol rate' | 'bitrate' | 'wavelength' grossrate
|
||||
cfg.y_axis = 'BER'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
|
||||
cfg.y_scale = 'auto'; % auto -> log for BER*, linear otherwise
|
||||
cfg.outlier = 'mad'; % simple, robust; 'none' or 'pctl' also available
|
||||
cfg.show_raw = false;
|
||||
cfg.show_spread = 'none'; % 'none' or 'iqr' or minmax
|
||||
cfg.agg = 'min'; % or 'median'
|
||||
cfg.show_precoded = 0;
|
||||
|
||||
% cfg.fec_lines = [2.2e-4 4.85e-3 2e-2]; % optional
|
||||
cfg.fec_lines = [];
|
||||
cfg.plot.custom_colors = [
|
||||
clr.Paired.red;
|
||||
clr.Paired.blue;
|
||||
clr.Paired.green;
|
||||
clr.Paired.orange;
|
||||
clr.Paired.purple
|
||||
];
|
||||
|
||||
cfg.plot.custom_colors_scatter = [
|
||||
clr.Paired.lightred;
|
||||
clr.Paired.lightblue;
|
||||
clr.Paired.lightgreen;
|
||||
clr.Paired.lightorange;
|
||||
clr.Paired.lightpurple
|
||||
];
|
||||
|
||||
|
||||
% New styling knobs
|
||||
cfg.plot.use_cbrewer2 = true;
|
||||
cfg.plot.colormap = 'Paired';
|
||||
cfg.plot.paired_dark_first = false; % dark for lines, light for scatter
|
||||
cfg.plot.lineWidth = 2.0;
|
||||
cfg.plot.errWidth = 1.2;
|
||||
cfg.plot.scatterAlpha = 0.35;
|
||||
cfg.plot.legendLocation = 'best';
|
||||
cfg.plot.fecLineWidth = 2.4; % thicker FEC limits
|
||||
cfg.plot.lineStyle_pre_emph_on = '-';
|
||||
cfg.plot.lineStyle_pre_emph_off = '-';
|
||||
|
||||
|
||||
%% Grid configuration
|
||||
rows = 3; % PAM 4,6,8
|
||||
cols = 4; % DSP schemes
|
||||
pam = [4 6 8];
|
||||
|
||||
cfg.figure_number = 46;
|
||||
fig = figure(cfg.figure_number); clf;
|
||||
|
||||
% Create extremely compact tile layout
|
||||
t = tiledlayout(rows, cols, ...
|
||||
'TileSpacing','compact', ...
|
||||
'Padding','compact');
|
||||
|
||||
% Common cfg
|
||||
cfg.show_precoded = 1;
|
||||
cfg.group_by = {'equalizer_structure','pre_emph'};
|
||||
cfg.x_axis = 'grossrate';
|
||||
cfg.y_axis = 'BER';
|
||||
cfg.y_scale = 'log';
|
||||
cfg.plot.custom_colors_scatter = [];
|
||||
cfg.plot.use_cbrewer2 = false;
|
||||
cfg.fec_lines = [];
|
||||
% DSP scheme definitions ---------------------------------------------
|
||||
DSP(1).name = 'vnle';
|
||||
DSP(1).eq = equalizer_structure.vnle;
|
||||
DSP(1).color = clr.Paired.red;
|
||||
DSP(1).lightcolor = clr.Paired.lightred;
|
||||
|
||||
DSP(2).name = 'VNLE PF MLSE';
|
||||
DSP(2).eq = equalizer_structure.vnle_pf_mlse;
|
||||
DSP(2).color = clr.Paired.green;
|
||||
DSP(2).lightcolor = clr.Paired.lightgreen;
|
||||
|
||||
DSP(3).name = 'VNLE DB MLSE';
|
||||
DSP(3).eq = equalizer_structure.vnle_db_mlse;
|
||||
DSP(3).color = clr.Paired.blue;
|
||||
DSP(3).lightcolor = clr.Paired.lightblue;
|
||||
|
||||
DSP(4).name = 'ML MLSE';
|
||||
DSP(4).eq = equalizer_structure.ml_mlse;
|
||||
DSP(4).color = clr.Paired.purple;
|
||||
DSP(4).lightcolor = clr.Paired.lightpurple;
|
||||
|
||||
|
||||
% === Main nested loop: rows = PAM format, columns = DSP scheme ===
|
||||
for r = 1:rows
|
||||
M = pam(r);
|
||||
|
||||
for c = 1:cols
|
||||
ax = nexttile(t, (r-1)*cols + c);
|
||||
cfg.ax = ax;
|
||||
|
||||
% ---- pre-emph = 1 (solid) ----
|
||||
cfg.plot.custom_colors = DSP(c).lightcolor;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',M, ...
|
||||
'equalizer_structure',DSP(c).eq, ...
|
||||
'pre_emph',1);
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% ---- pre-emph = 0 (dashed) ----
|
||||
cfg.plot.custom_colors = DSP(c).color;
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters.pre_emph = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
if M == 4
|
||||
ylim([1e-5 0.2]);
|
||||
else
|
||||
ylim([6e-4 0.2]);
|
||||
end
|
||||
|
||||
% % FEC limits
|
||||
yline([2.2e-4 4.85e-3 2e-2],'LineWidth',1.1,'Color',[0.2 0.2 0.2], ...
|
||||
'LineStyle',':','HandleVisibility','off');
|
||||
|
||||
% Axes prettification
|
||||
beautifyBERplot;
|
||||
|
||||
% ===== Remove redundant labels =====
|
||||
if c > 1
|
||||
ax.YLabel = [];
|
||||
end
|
||||
if r < rows
|
||||
ax.XLabel = [];
|
||||
end
|
||||
|
||||
grid(ax,'on'); box(ax,'on');
|
||||
end
|
||||
end
|
||||
|
||||
%this is just a ranom size but fits and is fixed now!
|
||||
pos = 1e3.*[0.0983 0.6110 1.4113 0.4733];
|
||||
set(fig, 'Position', pos)
|
||||
|
||||
|
||||
|
||||
|
||||
%% === EXPORT TO TIKZ ===
|
||||
outfile = 'C:\Users\Silas\Documents\latex\JLT_400G copy\media\matlab2tikz\compare_pre_emphasis.tikz';
|
||||
|
||||
matlab2tikz(outfile, ...
|
||||
'width','\fwidth', ...
|
||||
'height','\fheight', ...
|
||||
'showInfo',false, ...
|
||||
'extraAxisOptions',{ ...
|
||||
'legend style={font=\footnotesize}', ...
|
||||
'legend columns=1' ...
|
||||
} );
|
||||
@@ -0,0 +1,112 @@
|
||||
database_type = 'mysql';
|
||||
dataBase = 'labor_highspeed';
|
||||
db = DBHandler("dataBase", [dataBase], "type", database_type);
|
||||
|
||||
|
||||
M = 4;
|
||||
fp = QueryFilter();
|
||||
fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
||||
% fp.where('Runs', 'db_mode','EQUALS', 1); % 0 == high preemphasis // 1 == low preemphasis
|
||||
fp.where('Runs', 'rop_attenuation','EQUALS', 0);
|
||||
|
||||
fields = db.getTableFieldNames('power_state_info');
|
||||
fields = [fields; db.getTableFieldNames('dashboard_ungrouped_aug_nov_2025')]; %dashboard_ungrouped_after_nov_2025 dashboard_ungrouped_aug_nov_2025
|
||||
[dataTable,~] = db.queryDB(fp, fields);
|
||||
|
||||
%%
|
||||
cfg = struct;
|
||||
cfg.x_axis = 'grossrate'; % 'symbol rate' | 'bitrate' | 'wavelength' grossrate
|
||||
cfg.y_axis = 'BER'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
|
||||
cfg.y_scale = 'auto'; % auto -> log for BER*, linear otherwise
|
||||
cfg.outlier = 'mad'; % simple, robust; 'none' or 'pctl' also available
|
||||
cfg.show_raw = false;
|
||||
cfg.show_spread = 'none'; % 'none' or 'iqr' or minmax
|
||||
cfg.agg = 'min'; % or 'median'
|
||||
cfg.show_precoded = 0;
|
||||
% cfg.fec_lines = [2.2e-4 4.85e-3 2e-2]; % optional
|
||||
cfg.fec_lines = [];
|
||||
cfg.plot.custom_colors = [
|
||||
clr.Paired.red;
|
||||
clr.Paired.blue;
|
||||
clr.Paired.green;
|
||||
clr.Paired.orange;
|
||||
clr.Paired.purple
|
||||
];
|
||||
|
||||
cfg.plot.custom_colors_scatter = [
|
||||
clr.Paired.lightred;
|
||||
clr.Paired.lightblue;
|
||||
clr.Paired.lightgreen;
|
||||
clr.Paired.lightorange;
|
||||
clr.Paired.lightpurple
|
||||
];
|
||||
|
||||
|
||||
% New styling knobs
|
||||
cfg.plot.use_cbrewer2 = true;
|
||||
cfg.plot.colormap = 'Paired';
|
||||
cfg.plot.paired_dark_first = false; % dark for lines, light for scatter
|
||||
cfg.plot.lineWidth = 2.0;
|
||||
cfg.plot.errWidth = 1.2;
|
||||
cfg.plot.scatterAlpha = 0.35;
|
||||
cfg.plot.legendLocation = 'best';
|
||||
cfg.plot.fecLineWidth = 2.4; % thicker FEC limits
|
||||
cfg.plot.lineStyle_pre_emph_on = '-';
|
||||
cfg.plot.lineStyle_pre_emph_off = '-';
|
||||
|
||||
%%
|
||||
cfg.figure_number = 42;
|
||||
|
||||
|
||||
% ---- VNLE, no pre-emph (solid red) ----
|
||||
cfg.plot.custom_colors = [clr.Paired.red];
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',M, ...
|
||||
'equalizer_structure',equalizer_structure.vnle, ...
|
||||
'pre_emph',0);
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% ---- VNLE, with pre-emph (dashed red) ----
|
||||
cfg.plot.custom_colors = [clr.Paired.red];
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters.pre_emph = 1;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% ---- VNLE PF MLSE, no pre-emph (solid green) ----
|
||||
cfg.plot.custom_colors = [clr.Paired.green];
|
||||
cfg.plot.custom_linetypes = {'-'};
|
||||
cfg.filters.equalizer_structure = equalizer_structure.vnle_pf_mlse;
|
||||
cfg.filters.pre_emph = 0;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% ---- VNLE PF MLSE, with pre-emph (dashed green) ----
|
||||
cfg.plot.custom_colors = [clr.Paired.green];
|
||||
cfg.plot.custom_linetypes = {'--'};
|
||||
cfg.filters.pre_emph = 1;
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
|
||||
% === FEC LINES (no legend) ===
|
||||
yline([2.2e-4 4.85e-3 2e-2], ...
|
||||
'LineWidth',1.5,'Color',[0.4 0.4 0.4], ...
|
||||
'LineStyle',':','HandleVisibility','off');
|
||||
|
||||
|
||||
% === BEAUTIFY ===
|
||||
% beautifyBERplot; % your function
|
||||
|
||||
|
||||
%% === EXPORT TO TIKZ ===
|
||||
outfile = 'C:\Users\Silas\Documents\latex\JLT_400G copy\media\matlab2tikz\compare_pre_emphasis.tikz';
|
||||
|
||||
matlab2tikz(outfile, ...
|
||||
'width','\fwidth', ...
|
||||
'height','\fheight', ...
|
||||
'showInfo',false, ...
|
||||
'extraAxisOptions',{ ...
|
||||
'legend style={font=\footnotesize}', ...
|
||||
'legend columns=1' ...
|
||||
} );
|
||||
@@ -0,0 +1,100 @@
|
||||
dsp_options.storage_path = 'Z:\2024\sioe_labor\';
|
||||
dsp_options.max_occurences = 1;
|
||||
database = DBHandler("dataBase", 'labor_highspeed', "type", 'mysql' );
|
||||
|
||||
rate = 390e9;
|
||||
|
||||
%% 1 - PAM 4 with preemphasis
|
||||
fp = QueryFilter();
|
||||
M = 4;
|
||||
fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'bitrate','EQUALS', rate);%360,390
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
||||
fp.where('Runs', 'db_mode','EQUALS', 0);
|
||||
fp.where('Runs', 'rop_attenuation','EQUAL', 0);
|
||||
|
||||
[dataTable,~] = db.queryDB(fp, database.getTableFieldNames('Runs'));
|
||||
|
||||
dataTable = queryRunid(dataTable.run_id, database);
|
||||
fsym = dataTable.symbolrate;
|
||||
M = double(dataTable.pam_level);
|
||||
|
||||
% Load and Sync signal data from DB
|
||||
[Tx_bits, Symbols, Scpe_cell, ~] = loadAndSyncSignalDataFromDb(dataTable, dsp_options);
|
||||
|
||||
% Preprocess signal
|
||||
Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
||||
|
||||
if rate == 390e9
|
||||
Scpe_sig.spectrum("fignum",200,"normalizeTo0dB",1,"displayname",'Rx','addDCoffset',-5.8);
|
||||
elseif rate == 300e9
|
||||
Scpe_sig.spectrum("fignum",200,"normalizeTo0dB",1,"displayname",'Rx','addDCoffset',-4.7);
|
||||
end
|
||||
ylim([-30,3]);
|
||||
xlim([-5,100]);
|
||||
Scpe_sig.spectrum("fignum",201,"normalizeTo0dB",0,"displayname",'Rx');
|
||||
|
||||
|
||||
%% 1 - PAM 4 without preemphasis
|
||||
fp = QueryFilter();
|
||||
M = 4;
|
||||
fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
fp.where('Runs', 'bitrate','EQUALS', rate);%360,390
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
||||
fp.where('Runs', 'db_mode','EQUALS', 1);
|
||||
fp.where('Runs', 'rop_attenuation','EQUAL', 0);
|
||||
|
||||
[dataTable,~] = db.queryDB(fp, database.getTableFieldNames('Runs'));
|
||||
|
||||
dataTable = queryRunid(dataTable.run_id, database);
|
||||
fsym = dataTable.symbolrate;
|
||||
M = double(dataTable.pam_level);
|
||||
|
||||
% Load and Sync signal data from DB
|
||||
[Tx_bits, Symbols, Scpe_cell, ~] = loadAndSyncSignalDataFromDb(dataTable, dsp_options);
|
||||
|
||||
% Preprocess signal
|
||||
Scpe_sig = preprocessSignal(Scpe_cell{1}, Symbols, fsym);
|
||||
|
||||
Scpe_sig.spectrum("fignum",200,"normalizeTo0dB",1,"displayname",'Rx','addDCoffset',0);
|
||||
ylim([-30,3]);
|
||||
xlim([-5,100]);
|
||||
Scpe_sig.spectrum("fignum",201,"normalizeTo0dB",0,"displayname",'Rx');
|
||||
|
||||
|
||||
|
||||
if 0
|
||||
%% show freuqncy response of filter
|
||||
|
||||
measure = 1;
|
||||
|
||||
freqresp = ChannelFreqResp("Nacq",1024,"Navg",64,"Ncp",70,"f_ref",256e9);
|
||||
%
|
||||
Digi_sig = freqresp.buildOFDM();
|
||||
|
||||
Digi_sig.spectrum("fignum",1112,"displayname",['maxamp:',num2str(maxamp)]);
|
||||
|
||||
Digi_sig = Filter('filtdegree',3,"f_cutoff",70e9,"fs",256e9,"filterType",filtertypes.butterworth,"active",true).process(Digi_sig);
|
||||
|
||||
Digi_sig = Filter('filtdegree',3,"f_cutoff",70e9,"fs",256e9,"filterType",filtertypes.bessel_inp,"active",true).process(Digi_sig);
|
||||
|
||||
freqresp.estimate(Digi_sig,"fileName",'','save',false);
|
||||
|
||||
freqresp.plot()
|
||||
|
||||
a = gca;
|
||||
a.YTick = [-30,-20,-10,0];
|
||||
|
||||
%% system frex
|
||||
|
||||
|
||||
precomp_filename ='lab_high_speed';
|
||||
precomp_path = "C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\precomp";
|
||||
freqresp = ChannelFreqResp("Nacq",1024,"Navg",64,"Ncp",63,'f_ref',92e9);
|
||||
freqresp.load('loadPath', precomp_path, 'fileName', precomp_filename);
|
||||
|
||||
fprintf('Plotting: %s\n', precomp_filename);
|
||||
freqresp.plot();
|
||||
end
|
||||
@@ -0,0 +1,436 @@
|
||||
function h = plot_measurements_gpt(T, cfg)
|
||||
% Versatile plotting from your DB table (with cbrewer2 'Paired' palette).
|
||||
%
|
||||
% Usage:
|
||||
% h = plot_measurements_flex(dataTable, cfg)
|
||||
|
||||
%% ---- Defaults
|
||||
if nargin < 2, cfg = struct; end
|
||||
defaults = struct( ...
|
||||
'x_axis' , 'symbolrate', ...
|
||||
'y_axis' , 'BER', ...
|
||||
'y_scale' , 'auto', ...
|
||||
'group_by' , {{'equalizer_structure','pre_emph'}}, ...
|
||||
'filters' , struct, ...
|
||||
'agg' , 'mean', ...
|
||||
'outlier' , 'auto', ...
|
||||
'mad_z' , 4, ...
|
||||
'pct_limits' , [2.5 97.5], ...
|
||||
'min_pts_x' , 3, ...
|
||||
'show_raw' , true, ...
|
||||
'show_precoded', [], ...
|
||||
'show_spread' , 'none', ...
|
||||
'fec_lines' , [], ...
|
||||
'plot', struct() ...
|
||||
);
|
||||
cfg = filldefaults(cfg, defaults);
|
||||
|
||||
% ---- Plot defaults (new)
|
||||
plotdefs = struct( ...
|
||||
'use_cbrewer2' , true, ...
|
||||
'colormap' , 'Paired', ... % ColorBrewer 'Paired'
|
||||
'paired_dark_first' , true, ... % dark for lines, light for scatter
|
||||
'lineWidth' , 1.8, ...
|
||||
'errWidth' , 1.0, ...
|
||||
'scatterSize' , 14, ...
|
||||
'scatterAlpha' , 0.35, ...
|
||||
'marker' , 'o', ...
|
||||
'marker_precoded' , 's', ...
|
||||
'lineStyle_pre_emph_on' , '--', ...
|
||||
'lineStyle_pre_emph_off', '-', ...
|
||||
'legendLocation' , 'best', ...
|
||||
'fecLineWidth' , 2.2, ... % thicker FEC limits
|
||||
'fecColor' , [0.25 0.25 0.25], ...
|
||||
'capSize' , 6, ...
|
||||
'lineStyle_default' , '-', ...
|
||||
'use_pre_emph_styling' , true ...
|
||||
);
|
||||
cfg.plot = filldefaults(cfg.plot, plotdefs);
|
||||
|
||||
%% ---- Derived/prep columns
|
||||
if ~ismember('pre_emph', T.Properties.VariableNames)
|
||||
if ~ismember('db_mode', T.Properties.VariableNames)
|
||||
error('Missing column "db_mode" for pre_emph derivation.');
|
||||
end
|
||||
T.pre_emph = T.db_mode == 0;
|
||||
end
|
||||
if ~ismember(cfg.y_axis, T.Properties.VariableNames)
|
||||
error('y_axis "%s" not found in table.', cfg.y_axis);
|
||||
end
|
||||
|
||||
isBER = startsWith(cfg.y_axis, "BER", 'IgnoreCase', true);
|
||||
if strcmpi(cfg.y_scale,'auto'), cfg.y_scale = tern(isBER, 'log', 'linear'); end
|
||||
if strcmpi(cfg.outlier,'auto'), cfg.outlier = tern(isBER, 'mad', 'none'); end
|
||||
if isempty(cfg.show_precoded)
|
||||
cfg.show_precoded = isBER && ismember('BER_precoded', T.Properties.VariableNames);
|
||||
end
|
||||
|
||||
%% ---- Filters
|
||||
T = applyFilters(T, cfg.filters);
|
||||
[x_raw, x_label] = computeX(T, cfg.x_axis);
|
||||
y_raw = T.(cfg.y_axis);
|
||||
|
||||
validXY = isfinite(x_raw) & isfinite(y_raw);
|
||||
T = T(validXY, :);
|
||||
x_raw = x_raw(validXY);
|
||||
y_raw = y_raw(validXY);
|
||||
|
||||
if mean(abs(y_raw)) > 1e8
|
||||
%giga values
|
||||
y_raw = y_raw.*1e-9;
|
||||
end
|
||||
|
||||
if cfg.show_precoded && ismember('BER_precoded', T.Properties.VariableNames)
|
||||
y_raw_p = T.BER_precoded(validXY);
|
||||
else
|
||||
y_raw_p = [];
|
||||
end
|
||||
|
||||
%% ---- Grouping
|
||||
group_by = cfg.group_by;
|
||||
if ~all(ismember(group_by, T.Properties.VariableNames))
|
||||
error('Some group_by columns are missing in table.');
|
||||
end
|
||||
[G, grpTbl] = findgroups(T(:, group_by));
|
||||
nG = max(G);
|
||||
|
||||
% ==== Colors (cbrewer2 'Paired' with dark/ light pairs) ====
|
||||
[cols_line, cols_scatter] = buildGroupColors(nG, cfg.plot);
|
||||
|
||||
%% ---- Axes / Figure handling (new unified logic)
|
||||
|
||||
% Priority:
|
||||
% 1) cfg.ax → use existing axes (subplots/tiles)
|
||||
% 2) cfg.figure_number → select/create figure
|
||||
% 3) fallback: create new figure
|
||||
|
||||
if isfield(cfg,'ax') && ~isempty(cfg.ax) && isgraphics(cfg.ax,'axes')
|
||||
ax = cfg.ax; % use caller-provided axes
|
||||
set(gcf,'CurrentAxes',ax);
|
||||
else
|
||||
if isfield(cfg,'figure_number') && ~isempty(cfg.figure_number)
|
||||
figure(cfg.figure_number);
|
||||
else
|
||||
figure;
|
||||
end
|
||||
ax = gca; % active axes
|
||||
end
|
||||
|
||||
hold(ax,'on');
|
||||
grid(ax,'on');
|
||||
|
||||
|
||||
h.lines = gobjects(nG,1);
|
||||
h.err = gobjects(nG,1);
|
||||
h.scat = gobjects(nG,1);
|
||||
h.lines_p = gobjects(nG,1);
|
||||
|
||||
for gi = 1:nG
|
||||
idx = (G==gi);
|
||||
Ti = T(idx,:);
|
||||
xi = x_raw(idx);
|
||||
yi = y_raw(idx);
|
||||
|
||||
% Aggregate per unique x
|
||||
[xu, ia, iu] = unique(xi);
|
||||
yu = nan(size(xu));
|
||||
ylo = nan(size(xu));
|
||||
yhi = nan(size(xu));
|
||||
|
||||
for k = 1:numel(xu)
|
||||
bin = (iu==k);
|
||||
yy = yi(bin);
|
||||
yy = yy(isfinite(yy));
|
||||
if isempty(yy), continue; end
|
||||
km = outlierMask(yy, cfg, strcmpi(cfg.y_scale,'log'));
|
||||
if nnz(km) < cfg.min_pts_x, km = true(size(yy)); end
|
||||
yy = yy(km);
|
||||
|
||||
if strcmpi(cfg.agg,'median'), yu(k)=median(yy,'omitnan'); elseif strcmpi(cfg.agg,'mean'), yu(k)=mean(yy,'omitnan'); elseif strcmpi(cfg.agg,'min'), yu(k)=min(yy); elseif strcmpi(cfg.agg,'max'), yu(k)=max(yy); end
|
||||
if strcmpi(cfg.show_spread,'iqr')
|
||||
q = prctile(yy,[25 75]);
|
||||
ylo(k) = max(yu(k)-q(1), eps);
|
||||
yhi(k) = max(q(2)-yu(k), eps);
|
||||
elseif strcmpi(cfg.show_spread,'minmax')
|
||||
ylo(k) = min(yy);
|
||||
yhi(k) = max(yy);
|
||||
end
|
||||
end
|
||||
|
||||
% sort
|
||||
[xu, ord] = sort(xu);
|
||||
yu = yu(ord);
|
||||
ylo = ylo(ord);
|
||||
yhi = yhi(ord);
|
||||
|
||||
% Styles
|
||||
% Decide if we style by pre_emph
|
||||
% --- LINE TYPE SELECTION (no pre-emphasis logic) ---
|
||||
ls = cfg.plot.lineStyle_default;
|
||||
|
||||
% User-defined override (cycled)
|
||||
if isfield(cfg.plot,'custom_linetypes') && ~isempty(cfg.plot.custom_linetypes)
|
||||
L = cfg.plot.custom_linetypes;
|
||||
ls = L{ mod(gi-1, numel(L)) + 1 };
|
||||
end
|
||||
|
||||
lbl = buildLabel(grpTbl(gi,:), group_by);
|
||||
|
||||
% Main line (dark)
|
||||
colL = cols_line(gi,:);
|
||||
h.lines(gi) = plot(xu, yu, ...
|
||||
'LineWidth', cfg.plot.lineWidth, ...
|
||||
'Marker', cfg.plot.marker, 'MarkerSize', 3, ...
|
||||
'Color', colL, 'LineStyle', ls, ...
|
||||
'DisplayName', char(lbl));
|
||||
|
||||
% Spread (IQR) in line color
|
||||
if any(isfinite(ylo)) && any(isfinite(yhi))
|
||||
h.err(gi) = errorbar(xu, yu, ylo, yhi, 'LineStyle','none', ...
|
||||
'Color', colL, 'CapSize', cfg.plot.capSize, 'HandleVisibility','off');
|
||||
h.err(gi).LineWidth = cfg.plot.errWidth;
|
||||
end
|
||||
|
||||
% Raw kept scatter (light)
|
||||
if cfg.show_raw
|
||||
keep_all = false(size(yi));
|
||||
for k = 1:numel(xu)
|
||||
bin = (iu==k);
|
||||
yy = yi(bin);
|
||||
km = outlierMask(yy, cfg, strcmpi(cfg.y_scale,'log'));
|
||||
if nnz(km) < cfg.min_pts_x, km = true(size(yy)); end
|
||||
keep_all(bin) = km;
|
||||
end
|
||||
colS = cols_scatter(gi,:);
|
||||
scatter(xi(keep_all), yi(keep_all), cfg.plot.scatterSize, colS, 'filled', ...
|
||||
'MarkerFaceAlpha', cfg.plot.scatterAlpha, 'MarkerEdgeAlpha', cfg.plot.scatterAlpha, ...
|
||||
'HandleVisibility','off');
|
||||
end
|
||||
|
||||
% Precoded overlay (dotted, squares), in line color
|
||||
if cfg.show_precoded && ~isempty(y_raw_p) && strcmpi(cfg.y_axis,'BER')
|
||||
ypi = y_raw_p(idx);
|
||||
ypu = nan(size(xu));
|
||||
for k = 1:numel(xu)
|
||||
bin = (iu==k);
|
||||
yy = ypi(bin);
|
||||
yy = yy(isfinite(yy));
|
||||
if isempty(yy), continue; end
|
||||
km = outlierMask(yy, cfg, true);
|
||||
if nnz(km) < cfg.min_pts_x, km = true(size(yy)); end
|
||||
yy = yy(km);
|
||||
if strcmpi(cfg.agg,'median'), ypu(k)=median(yy,'omitnan'); elseif strcmpi(cfg.agg,'mean'), ypu(k)=mean(yy,'omitnan'); elseif strcmpi(cfg.agg,'min'), ypu(k)=min(yy); elseif strcmpi(cfg.agg,'max'), ypu(k)=max(yy); end
|
||||
end
|
||||
h.lines_p(gi) = plot(xu, ypu, ...
|
||||
'LineWidth', max(1.2, cfg.plot.lineWidth-0.2), ...
|
||||
'Marker', cfg.plot.marker_precoded, 'MarkerSize', 3, ...
|
||||
'Color', colL, 'LineStyle', ':', ...
|
||||
'DisplayName', [char(lbl) ' (precoded)']);
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
%% ---- Axes / Labels / FEC
|
||||
ylabel(cfg.y_axis, 'Interpreter','none');
|
||||
xlabel(x_label, 'Interpreter','none');
|
||||
set(gca, 'YScale', cfg.y_scale, 'FontSize', 11);
|
||||
% legend('Location', cfg.plot.legendLocation); box on;
|
||||
|
||||
xticks(floor(xu));
|
||||
xlim([min(xu), max(xu)])
|
||||
|
||||
if startsWith(cfg.y_axis,"BER",'IgnoreCase',true)
|
||||
for v = cfg.fec_lines
|
||||
yline(v, '--', 'Color', cfg.plot.fecColor, ...
|
||||
'LineWidth', cfg.plot.fecLineWidth, 'HandleVisibility','off');
|
||||
end
|
||||
ylim([1e-5, 0.5]);
|
||||
yticks([1e-5, 1e-4, 1e-3, 1e-2, 1e-1]);
|
||||
end
|
||||
|
||||
|
||||
|
||||
end % ===== main =====
|
||||
|
||||
|
||||
%% ===================== Helpers =====================
|
||||
|
||||
function cfg = filldefaults(cfg, defs)
|
||||
fn = fieldnames(defs);
|
||||
for i = 1:numel(fn)
|
||||
f = fn{i};
|
||||
if ~isfield(cfg, f) || isempty(cfg.(f))
|
||||
cfg.(f) = defs.(f);
|
||||
elseif isstruct(defs.(f)) && isstruct(cfg.(f))
|
||||
cfg.(f) = filldefaults(cfg.(f), defs.(f)); % recursive for structs
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function out = tern(cond, a, b)
|
||||
if cond
|
||||
out = a;
|
||||
else
|
||||
out = b;
|
||||
end
|
||||
end
|
||||
|
||||
function T2 = applyFilters(T, filters)
|
||||
if isempty(filters), T2 = T; return; end
|
||||
keep = true(height(T),1);
|
||||
fns = fieldnames(filters);
|
||||
for i = 1:numel(fns)
|
||||
name = fns{i};
|
||||
if ~ismember(name, T.Properties.VariableNames)
|
||||
warning('Filter column "%s" not found. Ignored.', name); %#ok<*WNTAG>
|
||||
continue
|
||||
end
|
||||
val = filters.(name);
|
||||
col = T.(name);
|
||||
if isa(val,'function_handle')
|
||||
m = val(col);
|
||||
if ~islogical(m) || ~isequal(size(m), size(col))
|
||||
error('Filter for %s must return logical mask of same size.', name);
|
||||
end
|
||||
keep = keep & m;
|
||||
else
|
||||
keep = keep & ismember(col, val);
|
||||
end
|
||||
end
|
||||
T2 = T(keep,:);
|
||||
end
|
||||
|
||||
function [x, label] = computeX(T, whichX)
|
||||
switch lower(whichX)
|
||||
case {'symbolrate','baudrate'}
|
||||
x = T.symbolrate * 1e-9;
|
||||
label = 'Symbol rate [GBd]';
|
||||
case 'bitrate'
|
||||
if ~ismember('pam_level', T.Properties.VariableNames)
|
||||
error('bitrate requires "pam_level" column.');
|
||||
end
|
||||
bits = floor(log2(double(T.pam_level))*10)/10;
|
||||
x = (T.symbolrate .* bits) * 1e-9;
|
||||
label = 'Grossrate [Gb/s]';
|
||||
case 'grossrate'
|
||||
x = (T.grossrate) * 1e-9;
|
||||
label = 'Grossrate [Gb/s]';
|
||||
otherwise
|
||||
if ~ismember(whichX, T.Properties.VariableNames)
|
||||
error('x_axis "%s" not found in table.', whichX);
|
||||
end
|
||||
x = T.(whichX);
|
||||
label = whichX;
|
||||
end
|
||||
x = double(x(:));
|
||||
end
|
||||
|
||||
function keep = outlierMask(y, cfg, useLog)
|
||||
if isempty(y), keep = false(size(y)); return; end
|
||||
y = y(:);
|
||||
switch lower(cfg.outlier)
|
||||
case 'none'
|
||||
keep = true(size(y)); return
|
||||
case 'mad'
|
||||
z = tern(useLog, log10(y), y);
|
||||
med = median(z,'omitnan');
|
||||
madv = median(abs(z-med),'omitnan');
|
||||
if ~(isfinite(madv) && madv>0)
|
||||
keep = true(size(y)); return
|
||||
end
|
||||
sigma = 1.4826*madv;
|
||||
zz = tern(useLog, log10(y), y);
|
||||
keep = abs(zz - med) <= cfg.mad_z*sigma;
|
||||
case 'pctl'
|
||||
pr = prctile(y, cfg.pct_limits);
|
||||
keep = (y >= pr(1)) & (y <= pr(2));
|
||||
otherwise
|
||||
error('Unknown outlier mode "%s".', cfg.outlier);
|
||||
end
|
||||
end
|
||||
|
||||
function s = buildLabel(grpRow, group_by)
|
||||
parts = strings(1, numel(group_by));
|
||||
for i = 1:numel(group_by)
|
||||
key = group_by{i};
|
||||
val = grpRow.(key);
|
||||
if iscell(val), val = val{1}; end
|
||||
if islogical(val), val = tern(val,'w/','w/o'); end
|
||||
if key == "equalizer_structure"
|
||||
key = '';
|
||||
val = upper(val);
|
||||
val = strrep(val,'_',' ');
|
||||
end
|
||||
|
||||
if key == "pre_emph"
|
||||
% key = strrep(key,'_','-');
|
||||
val = [val, ' pre-emph.'];
|
||||
key = '';
|
||||
end
|
||||
|
||||
parts(i) = sprintf('%s %s', key, string(val));
|
||||
end
|
||||
s = strjoin(parts, ', ');
|
||||
end
|
||||
|
||||
function [cols_line, cols_scatter] = buildGroupColors(nG, plotcfg)
|
||||
|
||||
% --- 1) User-provided custom colors -------------------------------
|
||||
if isfield(plotcfg,'custom_colors') && ~isempty(plotcfg.custom_colors)
|
||||
C = plotcfg.custom_colors;
|
||||
if size(C,1) < nG
|
||||
error('custom_colors must have at least nG=%d rows.', nG);
|
||||
end
|
||||
cols_line = C(1:nG, :);
|
||||
|
||||
% Scatter colors: either user-provided or lightened
|
||||
if isfield(plotcfg,'custom_colors_scatter') && ~isempty(plotcfg.custom_colors_scatter)
|
||||
Cs = plotcfg.custom_colors_scatter;
|
||||
if size(Cs,1) < nG
|
||||
error('custom_colors_scatter must have at least nG=%d rows.', nG);
|
||||
end
|
||||
cols_scatter = Cs(1:nG, :);
|
||||
else
|
||||
% auto-lighten scatter colors
|
||||
cols_scatter = zeros(nG,3);
|
||||
for i = 1:nG
|
||||
cols_scatter(i,:) = lightenColor(cols_line(i,:), 0.40);
|
||||
end
|
||||
end
|
||||
return;
|
||||
end
|
||||
|
||||
% --- 2) Standard behavior (using cbrewer2 or fallback) ------------
|
||||
useBrewer = plotcfg.use_cbrewer2 && exist('cbrewer2','file')==2;
|
||||
if useBrewer
|
||||
N = max(2*nG, 12);
|
||||
C = cbrewer2(plotcfg.colormap, N);
|
||||
cols_line = zeros(nG,3);
|
||||
cols_scatter = zeros(nG,3);
|
||||
for i = 1:nG
|
||||
if plotcfg.paired_dark_first
|
||||
dark = C(2*i-1, :);
|
||||
light = C(2*i, :);
|
||||
else
|
||||
light = C(2*i-1, :);
|
||||
dark = C(2*i, :);
|
||||
end
|
||||
cols_line(i,:) = dark;
|
||||
cols_scatter(i,:) = light;
|
||||
end
|
||||
else
|
||||
C = lines(max(nG,7));
|
||||
cols_line = C(1:nG,:);
|
||||
cols_scatter = zeros(nG,3);
|
||||
for i = 1:nG
|
||||
cols_scatter(i,:) = lightenColor(cols_line(i,:), 0.50);
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function c2 = lightenColor(c, fracTowardWhite)
|
||||
c = c(:).';
|
||||
c2 = (1-fracTowardWhite)*c + fracTowardWhite*1;
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
path = "C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\HighSpeedExperiment_2024\Auswertung_JLT\final\rates.csv";
|
||||
|
||||
%% === Read CSV into a table ===
|
||||
T = readtable(path, 'Delimiter', ';', 'DecimalSeparator', ',');
|
||||
|
||||
%% === Column definitions ===
|
||||
x = T.X_Werte;
|
||||
pam_cols = {'PAM_2','PAM_4','PAM_6','PAM_8','PAM_12'};
|
||||
titles = {'PAM-2','PAM-4','PAM-6','PAM-8','PAM-12'};
|
||||
|
||||
% === Create subplots ===
|
||||
figure;hold on
|
||||
c = linspecer(6);
|
||||
for k = 1:numel(pam_cols)
|
||||
|
||||
y = T.(pam_cols{k});
|
||||
valid = ~isnan(y);
|
||||
|
||||
|
||||
% Scatter plot
|
||||
s = scatter(x(valid), y(valid), 25, 'filled','MarkerEdgeColor',c(k,:),'MarkerFaceColor',c(k,:),'DisplayName',titles{k});
|
||||
|
||||
% Fit (2nd-order polynomial)
|
||||
p = polyfit(x(valid), y(valid), 2);
|
||||
xfit = linspace(min(x(valid)), max(x(valid)), 200);
|
||||
yfit = polyval(p, xfit);
|
||||
|
||||
% Plot fit curve
|
||||
plot(xfit, yfit, 'LineWidth', 1,'linestyle',':','Color',c(k,:),'HandleVisibility','off');
|
||||
|
||||
xlabel('baud rate [GBd]');
|
||||
ylabel('net rate [Gb/s]');
|
||||
end
|
||||
@@ -0,0 +1,38 @@
|
||||
X-Werte;PAM-2;PAM-4;PAM-6;PAM-8;PAM-12
|
||||
224;204;;;;
|
||||
205,5;193,4;;;;
|
||||
205,1;189,7;;;;
|
||||
192;168;;;;
|
||||
240;;427,4;;;
|
||||
225;;420,5;;;
|
||||
210;;336;;;
|
||||
184;;332;;;
|
||||
192;;320;;;
|
||||
176;;306,0869565;;;
|
||||
190;;304;;;
|
||||
168;;294;;;
|
||||
156,2;;287,1;;;
|
||||
160,8;;286,9;;;
|
||||
170;;272;;;
|
||||
132;;250,9505703;;;
|
||||
112;;209,3457944;;;
|
||||
172;;337;;;
|
||||
216;;;474,6;;
|
||||
147,2;;;329,9;;
|
||||
132;;;319,7891753;;
|
||||
143,1;;;318;;
|
||||
160;;;377;;
|
||||
225;;;;562,5;
|
||||
200;;;;510;
|
||||
160;;;;438;
|
||||
180;;;;432;
|
||||
180;;;;432;
|
||||
144;;;;384;
|
||||
143,7;;;;363,4;
|
||||
144;;;;360;
|
||||
136;;;;353,859497;
|
||||
136;;;;342,7995295;
|
||||
128;;;;329,0488432;
|
||||
129,7;;;;311,2;
|
||||
160;;;;413;
|
||||
160;;;;;481,2
|
||||
|
@@ -0,0 +1,76 @@
|
||||
database_type = 'mysql';
|
||||
dataBase = 'labor_highspeed';%'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\silas_labor_newdsp_newstructure.db';
|
||||
db = DBHandler("dataBase", [dataBase], "type", database_type);
|
||||
|
||||
M = 8;
|
||||
fp = QueryFilter();
|
||||
% fp.where('Runs', 'run_id','EQUALS', 987);
|
||||
fp.where('Runs', 'pam_level','EQUALS', M);
|
||||
% fp.where('Runs', 'symbolrate','EQUALS', 165e9); %150, 165, 180, 195, 210, 225, 240
|
||||
fp.where('Runs', 'fiber_length','EQUALS', 2);
|
||||
% fp.where('Runs', 'is_mpi','EQUALS', 0);
|
||||
% fp.where('Runs', 'power_pd_in','GREATER_THAN', 7);
|
||||
% fp.where('Runs', 'interference_path_length','EQUALS', 1000);
|
||||
% fp.where('Runs', 'loop_id','GREATER_THAN', 11);
|
||||
% fp.where('Runs', 'sir','EQUALS',18);
|
||||
fp.where('Runs', 'wavelength','EQUALS', 1310);
|
||||
% fp.where('Runs', 'db_mode','EQUALS', 1); % 0 == high preemphasis // 1 == low preemphasis
|
||||
% fp.where('Runs', 'rop_attenuation','EQUALS', 0);
|
||||
|
||||
fields = db.getTableFieldNames('power_state_info');
|
||||
fields = [fields; db.getTableFieldNames('dashboard_ungrouped_alltime')]; %dashboard_ungrouped_after_nov_2025 dashboard_ungrouped_aug_nov_2025
|
||||
[dataTable,~] = db.queryDB(fp, fields);
|
||||
|
||||
|
||||
%%
|
||||
cfg = struct;
|
||||
cfg.x_axis = 'grossrate'; % 'symbol rate' | 'bitrate' | 'wavelength' grossrate
|
||||
cfg.y_axis = 'BER'; % 'BER' | 'GMI' | 'AIR' | ...
|
||||
cfg.group_by = {'equalizer_structure','pre_emph'};
|
||||
cfg.filters = struct('is_mpi',0,'pam_level',M,'equalizer_structure',[equalizer_structure.ml_mlse]);%,equalizer_structure.vnle_pf_mlse,equalizer_structure.vnle]);
|
||||
|
||||
cfg.y_scale = 'auto'; % auto -> log for BER*, linear otherwise
|
||||
cfg.outlier = 'mad'; % simple, robust; 'none' or 'pctl' also available
|
||||
cfg.show_raw = false;
|
||||
cfg.show_spread = 'none'; % 'none' or 'iqr' or minmax
|
||||
cfg.agg = 'min'; % or 'median'
|
||||
cfg.show_precoded = 0;
|
||||
cfg.fec_lines = [2.2e-4 4.85e-3 2e-2]; % optional
|
||||
|
||||
cfg.figure_number = 42;
|
||||
cfg.plot.custom_colors = [
|
||||
clr.Paired.red;
|
||||
clr.Paired.blue;
|
||||
clr.Paired.green;
|
||||
clr.Paired.orange;
|
||||
clr.Paired.purple
|
||||
];
|
||||
|
||||
cfg.plot.custom_colors_scatter = [
|
||||
clr.Paired.lightred;
|
||||
clr.Paired.lightblue;
|
||||
clr.Paired.lightgreen;
|
||||
clr.Paired.lightorange;
|
||||
clr.Paired.lightpurple
|
||||
];
|
||||
|
||||
|
||||
% New styling knobs
|
||||
cfg.plot.use_cbrewer2 = true;
|
||||
cfg.plot.colormap = 'Paired';
|
||||
cfg.plot.paired_dark_first = false; % dark for lines, light for scatter
|
||||
cfg.plot.lineWidth = 2.0;
|
||||
cfg.plot.errWidth = 1.2;
|
||||
cfg.plot.scatterAlpha = 0.35;
|
||||
cfg.plot.legendLocation = 'best';
|
||||
cfg.plot.fecLineWidth = 2.4; % thicker FEC limits
|
||||
|
||||
plot_measurements_gpt(dataTable, cfg);
|
||||
|
||||
% beautifyBERplot()
|
||||
|
||||
%% FIG PRE EMPHASIS
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user