Files
imdd_silas/projects/HighSpeedExperiment_2024/Auswertung_JLT/final/example_usage.m

93 lines
3.0 KiB
Matlab

% ============================================================
% MINIMAL EXAMPLE: Query → Analyze → Plot → Extract X/Y data
% ============================================================
%% === Load from database ===
db = DBHandler("dataBase","labor_highspeed","type","mysql");
fp = QueryFilter();
fp.where('Runs','fiber_length','EQUALS',2);
% fp.where('Runs','pam_level','EQUALS',6); % PAM-4
% fp.where('Runs','db_mode','EQUALS',0); % w/o pre-emph
fields = db.getTableFieldNames('dashboard_ungrouped_alltime');
[dataTable,~] = db.queryDB(fp, fields);
%% === Define config ===
for m = [4,6,8]
cfg = struct;
cfg.x_axis = 'symbolrate';
cfg.y_axis = 'Alpha';
cfg.group_by = {'equalizer_structure','pre_emph'};
cfg.filters = struct('is_mpi',0,'pam_level',m, ...
'equalizer_structure',equalizer_structure.vnle_pf_mlse, ...
'pre_emph',0);
cfg.agg = 'max';
cfg.outlier = 'mad';
cfg.show_raw = false;
cfg.show_precoded = 0;
% Plot cosmetics (minimal)
cfg.plot = struct;
cfg.plot.custom_colors = linspecer(8);
cfg.plot.custom_linetypes = {'-'};
cfg.plot.lineWidth = 2;
% ============================================================
% === ANALYSIS ONLY (no plotting) =============================
% ============================================================
A = analyze_measurements_gpt(dataTable, cfg);
% Now you have:
% A.raw.x = raw x-values
% A.raw.y = raw BER values
% A.group{1}.x = unique sorted x-values
% A.group{1}.y = aggregated BER for each x
x_values = A.group{1}.x;
y_values = A.group{1}.y;
% ============================================================
% === PLOT ====================================================
% ============================================================
figure(10);hold on
cfg.ax = gca; % optional: plot into existing axes
plot(x_values,y_values,...
'LineWidth', 2, ...
'Color', clr.Set1.red, ...
'MarkerSize', 5, ...
'MarkerFaceColor', clr.Set1.red,...
'Marker','o');
% [h, ~] = plot_measurements_gpt(dataTable, cfg);
title('Minimal VNLE BER Example')
xlabel('Grossrate [Gb/s]')
ylabel('BER')
xticks(100:30:220)
xlim([100,220]);
ylim([0,1]);
end
% outfile = 'C:\Users\Silas\Documents\latex\JLT_400G copy\media\matlab2tikz\alphas.tikz';
% matlab2tikz(outfile, ...
% 'width','\fwidth', ...
% 'height','\fheight', ...
% 'showInfo',false, ...
% 'extraAxisOptions',{ ...
% 'legend style={font=\footnotesize}', ...
% 'legend columns=1' ...
% 'every axis/.append style={font=\scriptsize}',...
% 'minor grid style={line width=0.2pt, solid, color=black!10}',...
% 'grid style={line width=0.4pt, solid, color=black!20}',...
% 'grid style={dashed}',...
% });