Many changes in DBHandler
new general processing structure just before splitting off the projects folder from this repo
This commit is contained in:
@@ -12,13 +12,13 @@ arguments
|
||||
options.storage_path
|
||||
end
|
||||
|
||||
% database = DBHandler("pathToDB",[options.database_path,options.database_name],"type","sqlite");
|
||||
database = DBHandler("type","mysql");
|
||||
database = DBHandler("pathToDB",[options.database_path,options.database_name],"type","sqlite");
|
||||
% database = DBHandler("type","mysql");
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct('run_id', run_id);
|
||||
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path','Runs.tx_signal_path','Runs.tx_symbols_path','Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path','Runs.tx_symbols_path','Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
||||
'Configurations.interference_attenuation'};
|
||||
|
||||
@@ -28,8 +28,11 @@ dataTable = dataTable(uniqueIdx,:); % Extract unique configurations for each ru
|
||||
|
||||
fsym = dataTable.symbolrate;
|
||||
M = double(dataTable.pam_level);
|
||||
try
|
||||
duob_mode = db_mode.(strrep(char(dataTable.db_mode),'"',''));
|
||||
|
||||
catch
|
||||
duob_mode = db_mode(dataTable.db_mode);
|
||||
end
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
len_tr = 4096*2;
|
||||
@@ -82,8 +85,6 @@ dbtgt_package = {};
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
Tx_signal = load([options.storage_path, char(dataTable.tx_signal_path)]);
|
||||
Tx_signal = Tx_signal.Digi_sig;
|
||||
|
||||
Tx_bits = load([options.storage_path, char(dataTable.tx_bits_path)]);
|
||||
Tx_bits = Tx_bits.Bits;
|
||||
@@ -98,21 +99,21 @@ found_sync = 0;
|
||||
try
|
||||
Scpe_load = load([options.storage_path, char(dataTable.rx_sync_path)]);
|
||||
Scpe_cell = Scpe_load.S;
|
||||
[~,~,found_sync] = Scpe_cell{2}.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
[~,~,~,found_sync] = Scpe_cell{2}.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",1);
|
||||
end
|
||||
|
||||
if ~found_sync
|
||||
Scpe_sig_raw = load([options.storage_path, char(dataTable.rx_raw_path(1))]);
|
||||
Scpe_sig_raw = Scpe_sig_raw.Scpe_sig_raw;
|
||||
Scpe_sig_resampled = Scpe_sig_raw.resample("fs_in",Scpe_sig_raw.fs,"fs_out",2*fsym);
|
||||
[~,Scpe_cell,found_sync] =Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",1);
|
||||
[~,Scpe_cell,~,found_sync] =Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",1);
|
||||
end
|
||||
|
||||
if ~found_sync
|
||||
if length(Symbols_mapped.signal) == sum(Symbols_mapped.signal == Symbols.signal)
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
else
|
||||
[~,Scpe_cell,found_sync] =Scpe_sig_raw.tsynch("reference",Symbols_mapped,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
[~,Scpe_cell,~,found_sync] =Scpe_sig_raw.tsynch("reference",Symbols_mapped,"fs_ref",dataTable.symbolrate,"debug_plots",0);
|
||||
end
|
||||
if ~found_sync
|
||||
warning('Could not synchronize the received signal with the stored symbols!')
|
||||
@@ -120,7 +121,7 @@ if ~found_sync
|
||||
end
|
||||
|
||||
record_realizations = min(options.max_occurences,length(Scpe_cell));
|
||||
for occ = 4:record_realizations
|
||||
for occ = 1:record_realizations
|
||||
|
||||
Scpe_sig = Scpe_cell{occ};
|
||||
|
||||
@@ -136,10 +137,10 @@ for occ = 4:record_realizations
|
||||
|
||||
if duob_mode ~= db_mode.db_encoded
|
||||
|
||||
vnle_pf = 0;
|
||||
vnle_pf = 1;
|
||||
dbtgt = 0;
|
||||
% %%%%% VNLE + DFE %%%%
|
||||
if 1
|
||||
if 0
|
||||
|
||||
eq_ = FFE_DCremoval_adaptive_mu("epochs_tr",5,"epochs_dd",3,"len_tr",4096*2,"mu_dd",...
|
||||
0.0002,"mu_tr",0,"order",25,"sps",2,"decide",0,...
|
||||
@@ -149,6 +150,8 @@ for occ = 4:record_realizations
|
||||
"smoothing_buffer_length",smoothing_buffer_length,...
|
||||
"smoothing_buffer_update",smoothing_buffer_update);
|
||||
|
||||
eq_ = EQ("Ne",vnle_order,"Nb",dfe_order,"training_length",len_tr,"training_loops",5,"dd_loops",5,"K",2,"DCmu",mu_dc,"DDmu",[mu_ffe mu_dfe],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||
|
||||
result = vnle(eq_,M,Scpe_sig,Symbols,Tx_bits,"precode_mode",duob_mode,'showAnalysis',1,"postFFE",[],"eth_style_symbol_mapping",0);
|
||||
vnle_package{occ} = result;
|
||||
fprintf("FFE Results: %.2e\n", result.ber_vnle);
|
||||
@@ -196,7 +199,7 @@ for occ = 4:record_realizations
|
||||
|
||||
% Print header
|
||||
fprintf("==== EQUALIZATION RUN-ID %d | PAM-%d | %.2f GBd ====\n\n", run_id, M, Symbols.fs.*1e-9);
|
||||
s
|
||||
|
||||
% VNLE Results
|
||||
fprintf(">> VNLE Results:\n");
|
||||
fprintf(" BER %.2e\n", vnle_result.BER);
|
||||
|
||||
@@ -14,7 +14,7 @@ filterParams.Configurations = struct( ...
|
||||
'fiber_length', 0, ...
|
||||
'db_mode', '"no_db"', ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', 10, ...
|
||||
'interference_path_length', 0, ...
|
||||
'is_mpi', 1, ...
|
||||
'pam_level', 4, ...
|
||||
'wavelength', 1310, ...
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
run_id = 3966;
|
||||
|
||||
savePath = 'Z:\2025\ECOC Silas\ecoc_2025\';
|
||||
databasePath = 'C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\ECOC_2025\';
|
||||
@@ -11,37 +10,38 @@ db = DBHandler("type","mysql");
|
||||
filterParams = db.tables;
|
||||
% filterParams.Configurations = struct('run_id', run_id);
|
||||
filterParams.Configurations = struct( ...
|
||||
'symbolrate', [], ... %[224,336,360,390,420,448]
|
||||
'symbolrate', 112e9, ... %[224,336,360,390,420,448]
|
||||
'fiber_length', 0, ...
|
||||
'db_mode', '"no_db"', ...
|
||||
'interference_attenuation', 4, ...
|
||||
'interference_path_length', 10, ...
|
||||
'interference_path_length', 300, ...
|
||||
'is_mpi', 1, ...
|
||||
'pam_level', [], ...
|
||||
'pam_level', 4, ...
|
||||
'wavelength', 1310, ...
|
||||
'precomp_amp', [], ...
|
||||
'signal_attenuation', [], ...
|
||||
'v_awg', [], ...
|
||||
'v_bias', 2.65 ...
|
||||
'v_awg', [], ...
|
||||
'v_bias', [] ...
|
||||
);
|
||||
|
||||
|
||||
selectedFields = {'Runs.run_id','Runs.tx_bits_path','Runs.tx_signal_path','Runs.tx_symbols_path','Runs.rx_sync_path','Runs.rx_raw_path',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
||||
'Configurations.interference_attenuation'};
|
||||
'Configurations.interference_attenuation', 'Measurements.power_mpi_interference'};
|
||||
|
||||
[dataTable,sql_query] = db.queryDB(filterParams, selectedFields);
|
||||
|
||||
[~, uniqueIdx] = unique(dataTable.run_id); % Get unique run_id indices
|
||||
|
||||
dataTable.SIR = -7 - round(dataTable.power_mpi_interference);
|
||||
|
||||
for i = 1:4%size(dataTable,1)
|
||||
%%
|
||||
for i = 1:size(dataTable,1)
|
||||
dataTable_ = dataTable(i,:); % Extract unique configurations for each run_id
|
||||
|
||||
|
||||
fsym = dataTable_.symbolrate;
|
||||
M = double(dataTable_.pam_level);
|
||||
duob_mode = db_mode.(strrep(char(dataTable_.db_mode),'"',''));
|
||||
|
||||
|
||||
Tx_signal = load([savePath, char(dataTable_.tx_signal_path)]);
|
||||
Tx_signal = Tx_signal.Digi_sig;
|
||||
|
||||
@@ -52,17 +52,52 @@ for i = 1:4%size(dataTable,1)
|
||||
|
||||
Symbols = load([savePath, char(dataTable_.tx_symbols_path)]);
|
||||
Symbols = Symbols.Symbols;
|
||||
|
||||
|
||||
Scpe_sig_raw = load([savePath, char(dataTable_.rx_raw_path(1))]);
|
||||
Scpe_sig_raw = Scpe_sig_raw.Scpe_sig_raw;
|
||||
Scpe_sig_raw.plot("displayname",['Scope Signal (Run ID: ',num2str(dataTable_.run_id)],"fignum",dataTable_.run_id,"clear",0);
|
||||
% Scpe_sig_raw.plot("displayname",['Scope Signal (Run ID: ',num2str(dataTable_.run_id)],"fignum",dataTable_.run_id,"clear",0);
|
||||
|
||||
|
||||
Scpe_sig_resampled = Scpe_sig_raw.resample("fs_in",Scpe_sig_raw.fs,"fs_out",2*fsym);
|
||||
[~,Scpe_cell,found_sync,~,shifts] = Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",dataTable_.symbolrate,"debug_plots",1);
|
||||
Scpe_sig_resampled = Scpe_sig_raw.resample("fs_in",Scpe_sig_raw.fs,"fs_out",fsym);
|
||||
[~,Scpe_cell,found_sync,test,shifts] = Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",dataTable_.symbolrate,"debug_plots",0);
|
||||
|
||||
shifts_mus = shifts./Scpe_sig_resampled.fs .*1e6;
|
||||
Scpe_sig_raw.plot("displayname",['Scope Signal (Run ID: ',num2str(dataTable_.run_id)],"fignum",dataTable_.run_id,"clear",0);
|
||||
Scpe_sig_resampled = Scpe_sig_resampled.normalize("mode","rms");
|
||||
% Scpe_sig_resampled.plot("displayname",['Scope Signal (Run ID: ',num2str(dataTable_.run_id)],"fignum",dataTable_.run_id,"clear",0);
|
||||
hold on;
|
||||
xline(shifts_mus,'HandleVisibility','off');
|
||||
% xline(shifts_mus,'HandleVisibility','off');
|
||||
|
||||
shifts = shifts-shifts(1)+1;
|
||||
sep_sig = NaN(M,length(Scpe_sig_resampled));
|
||||
avg_sig = NaN(M,length(Scpe_sig_resampled));
|
||||
for j = 1:size(Scpe_cell,1)
|
||||
|
||||
[sep_sig_,avg_sig_]=showLevelScatter(Scpe_cell{j}.resample("fs_out",Symbols.fs),Symbols,"fignum",400);
|
||||
s = shifts(j);
|
||||
sep_sig(:,s+1:s+length(sep_sig_)) = sep_sig_;
|
||||
avg_sig(:,s+1:s+length(avg_sig_)) = avg_sig_;
|
||||
|
||||
end
|
||||
|
||||
disp(num2str(filterParams.Configurations.interference_path_length));
|
||||
var(sep_sig,0,2,'omitnan')
|
||||
%%
|
||||
xax_in_sec = ((1:length(avg_sig)) / fsym) * 1e6;
|
||||
figure();hold on;
|
||||
cols = cbrewer2('Paired',8);
|
||||
% for p = 1:size(avg_sig,1)
|
||||
% sc=scatter(xax_in_sec,sep_sig(p,:),1,'.','MarkerEdgeColor',cols((2*p)-1,:),'MarkerEdgeAlpha',0.1);
|
||||
% end
|
||||
for p = 1:size(avg_sig,1)
|
||||
sc=plot(xax_in_sec,avg_sig(p,:),'LineWidth',1,'Color',cols((2*p),:));
|
||||
end
|
||||
|
||||
yline(unique(Symbols.signal),'HandleVisibility','off');
|
||||
% xline(shifts./ fsym .*1e6,'HandleVisibility','off');
|
||||
xlabel('time in $\mu$s');
|
||||
ylabel('Normalized Amplitude');
|
||||
xlim([0 25]);
|
||||
ylim([-2 2]);
|
||||
|
||||
drawnow;
|
||||
end
|
||||
@@ -16,7 +16,7 @@ filterParams.Configurations = struct( ...
|
||||
'wavelength', 1310, ...
|
||||
'precomp_amp', [], ...
|
||||
'signal_attenuation', [], ...
|
||||
'v_awg', [], ...
|
||||
'v_awg', [], ...
|
||||
'v_bias', [] ...
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ filterParams.Configurations = struct( ...
|
||||
% % filterParams.EqualizerParameters.dc_buffer_len = 1;
|
||||
% filterParams.EqualizerParameters.ffe_buffer_len = 1;
|
||||
% filterParams.EqualizerParameters.smoothing_buffer_len = 4096;
|
||||
% filterParams.EqualizerParameters.smoothing_buffer_update = 224;
|
||||
% filterParams.EqualizerParameters.smoothing_buffer_update = 224;
|
||||
% filterParams.EqualizerParameters.DCmu = 0;
|
||||
% end
|
||||
|
||||
@@ -34,220 +34,291 @@ selectedFields = {'Configurations.run_id' 'Runs.loop_id' 'Runs.date_of_run' 'Run
|
||||
'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'EqualizerParameters.dc_buffer_len' 'EqualizerParameters.ffe_buffer_len' 'EqualizerParameters.smoothing_buffer_len' 'EqualizerParameters.smoothing_buffer_update' 'EqualizerParameters.DCmu' 'Measurements.power_pd_in' ...
|
||||
'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.BER_precoded' 'Results.EVM' 'Results.SNR' 'Results.GMI' 'Results.Alpha' 'Results.date_of_processing'};
|
||||
|
||||
% [dataTable_raw,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
[dataTable_raw,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
%%
|
||||
|
||||
dataTable_clean = dataTable_raw;
|
||||
dataTable_clean.SIR = -7 - round(dataTable_clean.power_mpi_interference);
|
||||
dataTable_clean.NGMI = dataTable_clean.GMI ./ log2(dataTable_clean.pam_level);
|
||||
dataTable_clean = cleanUpTable(dataTable_clean);
|
||||
|
||||
dataTable_clean(dataTable_clean.BER>0.2,:) = [];
|
||||
|
||||
%%
|
||||
|
||||
|
||||
|
||||
|
||||
dataTable_clean = dataTable_raw;
|
||||
dataTable_clean.SIR = round(-7.5 - dataTable_clean.power_mpi_interference);
|
||||
dataTable_clean.NGMI = dataTable_clean.GMI ./ log2(dataTable_clean.pam_level);
|
||||
dataTable_clean = cleanUpTable(dataTable_clean);
|
||||
|
||||
%%
|
||||
|
||||
dataTable = dataTable_clean;
|
||||
|
||||
figure(26);
|
||||
plotBoundaries = 1;
|
||||
plotRealizations = 0;
|
||||
cols = linspecer(8); % Ensure color count matches
|
||||
figure()
|
||||
tiledlayout(1, 4, 'TileSpacing', 'compact', 'Padding', 'compact');
|
||||
y_here = 0;
|
||||
figcnt = 0;
|
||||
for int_len = [0,50,300,1000]
|
||||
figcnt = figcnt+1;
|
||||
% figure(int_len+1);
|
||||
nexttile;
|
||||
hold on
|
||||
mode = 4;
|
||||
|
||||
% ideal DC tracking
|
||||
if 0
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0.005, :);
|
||||
cols = cols(1:1+1,:);
|
||||
method = 'ideal dc tracking';
|
||||
% slow DC tracking
|
||||
elseif 1
|
||||
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 224, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0.005, :);
|
||||
cols = cols(2:2+1,:);
|
||||
method = 'parallelized dc tracking';
|
||||
% slow DC smoothing
|
||||
elseif 0
|
||||
for mode = [1,4]
|
||||
|
||||
hold on;
|
||||
dataTable = dataTable_clean;
|
||||
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 4096, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 224, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0, :);
|
||||
cols = cols(3:3+1,:);
|
||||
method = 'dc smoothing';
|
||||
elseif 0
|
||||
% No compensation method
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0, :);
|
||||
cols = cols(4:4+1,:);
|
||||
method = 'ffe only';
|
||||
end
|
||||
|
||||
dataTable(dataTable.eq_id==0,:) = [];
|
||||
dataTable(dataTable.equalizer_structure~=1,:) = [];
|
||||
plotBoundaries = 1;
|
||||
plotRealizations = 1;
|
||||
cols = linspecer(8); % Ensure color count matches
|
||||
|
||||
% dataTable.interference_path_length(dataTable.interference_path_length < 20, :) = 20;
|
||||
if mode == 1
|
||||
% No compensation method
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0, :);
|
||||
cols = cols(1:1+1,:);
|
||||
method = 'ffe only';
|
||||
|
||||
dataTable = dataTable(dataTable.interference_path_length == 1000, :);
|
||||
% slow DC smoothing
|
||||
elseif mode == 2
|
||||
|
||||
% dataTable(dataTable.interference_path_length ~= 50, :) = [];
|
||||
% dataTable = dataTable(dataTable.interference_path_length < 51, :);
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 4096, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 224, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0, :);
|
||||
|
||||
cols = cols(4:4+1,:);
|
||||
method = 'dc smoothing';
|
||||
|
||||
% dataTable(dataTable.loop_id<200,:) = [];
|
||||
|
||||
% Filter by time
|
||||
filter_by_time = 0;
|
||||
if filter_by_time
|
||||
startTime = datetime('2025-04-20 18:00:00', 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
|
||||
stopTime = datetime('2025-04-30 19:30:00', 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
|
||||
dataTable.date_of_run = datetime(dataTable.date_of_run, 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS');
|
||||
dataTable.date_of_processing = datetime(dataTable.date_of_processing, 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS');
|
||||
dataTable = dataTable(dataTable.date_of_processing > startTime, :);
|
||||
dataTable = dataTable(dataTable.date_of_processing < stopTime, :);
|
||||
end
|
||||
% slow DC tracking
|
||||
elseif mode == 3
|
||||
|
||||
% Group by smth
|
||||
y_var = 'BER';
|
||||
x_var = 'SIR';
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 224, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0.005, :);
|
||||
|
||||
cols = cols(3:3+1,:);
|
||||
method = 'parallelized dc tracking';
|
||||
|
||||
loop_var = 'interference_path_length';
|
||||
fixedVars = {'equalizer_structure','interference_path_length',x_var};
|
||||
elseif mode == 4
|
||||
|
||||
[dataTable, outliersTable] = removeGroupOutliers(dataTable, fixedVars, y_var);
|
||||
% ideal DC tracking
|
||||
dataTable = dataTable(dataTable.dc_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.ffe_buffer_len == 1, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_len == 0, :);
|
||||
dataTable = dataTable(dataTable.smoothing_buffer_update == 0, :);
|
||||
dataTable = dataTable(dataTable.DCmu == 0.005, :);
|
||||
|
||||
cols = cols(2:2+1,:);
|
||||
method = 'ideal dc tracking';
|
||||
end
|
||||
|
||||
dataTableGrpd_mean = groupIt(fixedVars, dataTable, @mean);
|
||||
dataTableGrpd_min = groupIt(fixedVars, dataTable, @min);
|
||||
dataTableGrpd_max = groupIt(fixedVars, dataTable, @max);
|
||||
dataTable(dataTable.eq_id==0,:) = [];
|
||||
dataTable(dataTable.equalizer_structure~=1,:) = [];
|
||||
|
||||
% Create a new figure
|
||||
mkr = '.';
|
||||
hold on
|
||||
% Modify values in 'interference_path_length' where the condition is met
|
||||
dataTable.interference_path_length(dataTable.interference_path_length < 101 & dataTable.interference_path_length > 1) = 50;
|
||||
|
||||
unique_loop_var = unique(dataTable.(loop_var));
|
||||
dataTable.interference_path_length(dataTable.interference_path_length == 1) = 0;
|
||||
dataTable = dataTable(dataTable.interference_path_length == int_len, :);
|
||||
|
||||
for i = 1:numel(unique_loop_var)
|
||||
|
||||
% Prepare filtered data for this loop variable
|
||||
loopValue = unique_loop_var(i);
|
||||
dataTable(dataTable.run_id == 3866, :) = [];
|
||||
dataTable(dataTable.run_id == 3865, :) = [];
|
||||
dataTable(dataTable.run_id == 3796, :) = [];
|
||||
dataTable(dataTable.run_id == 3797, :) = [];
|
||||
dataTable(dataTable.run_id == 3798, :) = [];
|
||||
dataTable(dataTable.run_id == 4002, :) = [];
|
||||
dataTable(dataTable.run_id == 4200, :) = [];
|
||||
dataTable(dataTable.run_id == 4199, :) = [];
|
||||
|
||||
loopFiltGrpd = dataTableGrpd_mean.(loop_var) == loopValue;
|
||||
if ~any(loopFiltGrpd)
|
||||
continue; % Skip if no data for this loop var
|
||||
end
|
||||
% 0
|
||||
% 1
|
||||
% 10
|
||||
% 15
|
||||
% 20
|
||||
% 50
|
||||
% 100
|
||||
% 300
|
||||
% 1000
|
||||
|
||||
% Extract values
|
||||
x_values = dataTableGrpd_mean.(x_var)(loopFiltGrpd, :);
|
||||
y_mean = dataTableGrpd_mean.(y_var)(loopFiltGrpd, :);
|
||||
y_min = dataTableGrpd_min.(y_var)(loopFiltGrpd, :);
|
||||
y_max = dataTableGrpd_max.(y_var)(loopFiltGrpd, :);
|
||||
% dataTable(dataTable.interference_path_length ~= 50, :) = [];
|
||||
% dataTable = dataTable(dataTable.interference_path_length < 51, :);
|
||||
|
||||
% Compute bounds: distance from mean
|
||||
y_lower = y_mean - y_min;
|
||||
y_upper = y_max - y_mean;
|
||||
y_bounds = [y_lower, y_upper];
|
||||
% dataTable(dataTable.loop_id<200,:) = [];
|
||||
|
||||
% Display name (optional)
|
||||
try
|
||||
idx = find(dataTable.(loop_var) == loopValue, 1, 'first');
|
||||
% dispname = char(equalizer_structure(dataTable.equalizer_structure(idx)));
|
||||
dispname = [method];
|
||||
dispname = [dispname, '/ ',num2str(unique_loop_var(i)) ,' m'];
|
||||
% dispname = [dispname,'; ',num2str(unique(dataTable.interference_path_length)),' m'];
|
||||
dispname = [dispname, '/ PAM ', num2str(filterParams.Configurations.pam_level)];
|
||||
dispname = [dispname, '/ ', num2str(filterParams.Configurations.symbolrate.*1e-9),' GBd'];
|
||||
end
|
||||
% Filter by time
|
||||
filter_by_time = 0;
|
||||
if filter_by_time
|
||||
startTime = datetime('2025-04-20 18:00:00', 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
|
||||
stopTime = datetime('2025-04-30 19:30:00', 'InputFormat', 'yyyy-MM-dd HH:mm:ss');
|
||||
dataTable.date_of_run = datetime(dataTable.date_of_run, 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS');
|
||||
dataTable.date_of_processing = datetime(dataTable.date_of_processing, 'InputFormat', 'yyyy-MM-dd HH:mm:ss.SSSSSS');
|
||||
dataTable = dataTable(dataTable.date_of_processing > startTime, :);
|
||||
dataTable = dataTable(dataTable.date_of_processing < stopTime, :);
|
||||
end
|
||||
|
||||
if plotBoundaries
|
||||
% Plot bounded line
|
||||
[hl, hp] = boundedline(x_values, y_mean, y_bounds, ...
|
||||
'alpha', 'transparency', 0.1, ...
|
||||
'cmap', cols(i,:), ...
|
||||
'nan', 'fill', ...
|
||||
'orientation', 'vert');
|
||||
|
||||
% % Style the main line: thinnest, dotted, no marker
|
||||
set(hl, 'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none', ...
|
||||
'Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
% Group by smth
|
||||
y_var = 'BER';
|
||||
x_var = 'SIR';
|
||||
|
||||
plt = errorbar(x_values,y_mean,y_lower,y_upper,'LineWidth', 0.1, 'LineStyle', 'none', 'Marker', 'none','Color', cols(i,:), 'DisplayName', string(dispname),'HandleVisibility','off');
|
||||
|
||||
% Hide patch (shaded area) from legend
|
||||
set(hp, 'HandleVisibility', 'off','LineStyle',':','LineWidth',0.5,'Marker','none');
|
||||
|
||||
% % Add invisible scatter for DataTips
|
||||
% plt = scatter(x_values, y_mean, ...
|
||||
% 'Marker', 'o', 'MarkerEdgeColor', 'none', 'MarkerFaceColor', 'none', ...
|
||||
% 'HandleVisibility', 'off', 'PickableParts', 'all');
|
||||
else
|
||||
loop_var = 'interference_path_length';
|
||||
fixedVars = {'equalizer_structure','interference_path_length',x_var};
|
||||
|
||||
plt= plot(x_values,y_mean,'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none', ...
|
||||
'Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
% plt= errorbar(x_values,y_mean,y_lower,y_upper,'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none','Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
[dataTable, outliersTable] = removeGroupOutliers(dataTable, fixedVars, y_var);
|
||||
|
||||
dataTableGrpd_mean = groupIt(fixedVars, dataTable, @mean);
|
||||
dataTableGrpd_min = groupIt(fixedVars, dataTable, @min);
|
||||
dataTableGrpd_max = groupIt(fixedVars, dataTable, @max);
|
||||
|
||||
% Create a new figure
|
||||
|
||||
hold on
|
||||
|
||||
unique_loop_var = unique(dataTable.(loop_var));
|
||||
|
||||
for i = 1:numel(unique_loop_var)
|
||||
|
||||
% Prepare filtered data for this loop variable
|
||||
loopValue = unique_loop_var(i);
|
||||
|
||||
loopFiltGrpd = dataTableGrpd_mean.(loop_var) == loopValue;
|
||||
if ~any(loopFiltGrpd)
|
||||
continue; % Skip if no data for this loop var
|
||||
end
|
||||
|
||||
% Extract values
|
||||
x_values = dataTableGrpd_mean.(x_var)(loopFiltGrpd, :);
|
||||
y_mean = dataTableGrpd_mean.(y_var)(loopFiltGrpd, :);
|
||||
y_min = dataTableGrpd_min.(y_var)(loopFiltGrpd, :);
|
||||
y_max = dataTableGrpd_max.(y_var)(loopFiltGrpd, :);
|
||||
|
||||
% Compute bounds: distance from mean
|
||||
y_lower = y_mean - y_min;
|
||||
y_upper = y_max - y_mean;
|
||||
y_bounds = [y_lower, y_upper];
|
||||
|
||||
% Display name (optional)
|
||||
try
|
||||
idx = find(dataTable.(loop_var) == loopValue, 1, 'first');
|
||||
% dispname = char(equalizer_structure(dataTable.equalizer_structure(idx)));
|
||||
dispname = [method];
|
||||
dispname = [dispname, '/ ',num2str(unique_loop_var(i)) ,' m'];
|
||||
% dispname = [dispname,'; ',num2str(unique(dataTable.interference_path_length)),' m'];
|
||||
% dispname = [dispname, '/ PAM ', num2str(filterParams.Configurations.pam_level)];
|
||||
% dispname = [dispname, '/ ', num2str(filterParams.Configurations.symbolrate.*1e-9),' GBd'];
|
||||
end
|
||||
|
||||
if plotBoundaries
|
||||
% Plot bounded line
|
||||
[hl, hp] = boundedline(x_values, y_mean, y_bounds, ...
|
||||
'alpha', 'transparency', 0.1, ...
|
||||
'cmap', cols(i,:), ...
|
||||
'nan', 'fill', ...
|
||||
'orientation', 'vert');
|
||||
|
||||
% % Style the main line: thinnest, dotted, no marker
|
||||
set(hl, 'LineWidth', 0.5, 'LineStyle', ':', 'Marker', 'none', ...
|
||||
'Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
|
||||
plt = errorbar(x_values,y_mean,y_lower,y_upper,'LineWidth', 0.9, 'LineStyle', 'none', 'Marker', 'none','Color', cols(i,:), 'DisplayName', string(dispname),'HandleVisibility','off');
|
||||
|
||||
% Hide patch (shaded area) from legend
|
||||
set(hp, 'HandleVisibility', 'off','LineStyle',':','LineWidth',0.5,'Marker','none');
|
||||
|
||||
% Fit a 4th-order polynomial to log10(BER)
|
||||
p = polyfit(x_values, log10(y_mean), 3); % 4 is fitting order, adjust as needed
|
||||
|
||||
% Evaluate the fitted polynomial
|
||||
x_fit = linspace(min(x_values), max(x_values), 300); % Fine points
|
||||
y_fit_log = polyval(p, x_fit); % Still in log10 domain
|
||||
y_fit = 10.^y_fit_log; % Back to BER domain
|
||||
|
||||
|
||||
|
||||
plot(x_fit,y_fit,'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none', ...
|
||||
'Color', cols(i,:), 'DisplayName', string(dispname),'HandleVisibility','off');
|
||||
|
||||
% % Add invisible scatter for DataTips
|
||||
% plt = scatter(x_values, y_mean, ...
|
||||
% 'Marker', 'o', 'MarkerEdgeColor', 'none', 'MarkerFaceColor', 'none', ...
|
||||
% 'HandleVisibility', 'off', 'PickableParts', 'all');
|
||||
else
|
||||
|
||||
plt= plot(x_values,y_mean,'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none', ...
|
||||
'Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
% plt= errorbar(x_values,y_mean,y_lower,y_upper,'LineWidth', 1, 'LineStyle', '-', 'Marker', 'none','Color', cols(i,:), 'DisplayName', string(dispname));
|
||||
|
||||
end
|
||||
% Add data tips to the invisible scatter
|
||||
pair_one = {'Run ID', dataTableGrpd_mean.run_id(loopFiltGrpd, :)};
|
||||
pair_two = {'Rate', dataTableGrpd_mean.bitrate(loopFiltGrpd, :) * 1e-9};
|
||||
pair_three = {'PD in', round(dataTableGrpd_mean.power_pd_in(loopFiltGrpd, :), 2)};
|
||||
addDatatips(plt, pair_one, pair_two, pair_three);
|
||||
|
||||
|
||||
|
||||
% Optionally: outline bounds for better visibility (optional)
|
||||
% hnew = outlinebounds(hl, hp);
|
||||
|
||||
% Tick marks (x-axis)
|
||||
|
||||
|
||||
% Optional: scatter realizations
|
||||
if plotRealizations
|
||||
loopFiltSingle = dataTable.(loop_var) == loopValue;
|
||||
x_single = double(dataTable.(x_var)(loopFiltSingle, :));
|
||||
y_single = double(dataTable.(y_var)(loopFiltSingle, :));
|
||||
|
||||
mkr = '.';
|
||||
sc = scatter(x_single+(mode*0.1)-0.2, y_single,15, 'Marker', mkr, 'MarkerEdgeColor', cols(i, :), ...
|
||||
'LineWidth', 0.5, 'HandleVisibility', 'off', 'DisplayName', string(dispname));
|
||||
|
||||
pair_one = {'Run ID', dataTable.run_id(loopFiltSingle, :)};
|
||||
pair_two = {'Rate', dataTable.bitrate(loopFiltSingle, :) * 1e-9};
|
||||
pair_three = {'PD in', round(dataTable.power_pd_in(loopFiltSingle, :), 2)};
|
||||
addDatatips(sc, pair_one, pair_two, pair_three);
|
||||
end
|
||||
end
|
||||
|
||||
% Label axes and title
|
||||
legend('Interpreter', 'latex');
|
||||
xlabel(x_var);
|
||||
if ~y_here
|
||||
ylabel(y_var);
|
||||
yticklabels = [];
|
||||
|
||||
y_here = 1;
|
||||
end
|
||||
if int_len ~= 0
|
||||
set(gca, 'YTick', []);
|
||||
end
|
||||
% title([x_var, ' vs. ', y_var]);
|
||||
|
||||
if string(y_var) == "BER"
|
||||
yline(2.2e-4, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
yline(3.8e-3, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
yline(2e-2, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
ylim([1e-5, 0.1]);
|
||||
end
|
||||
|
||||
xlim([15,35]);
|
||||
ylim([9e-5 0.1 ]);
|
||||
xticks([13:2:35]);
|
||||
|
||||
% Enable grid and beautify
|
||||
grid on;
|
||||
beautifyBERplot;
|
||||
|
||||
end
|
||||
% Add data tips to the invisible scatter
|
||||
pair_one = {'Run ID', dataTableGrpd_mean.run_id(loopFiltGrpd, :)};
|
||||
pair_two = {'Rate', dataTableGrpd_mean.bitrate(loopFiltGrpd, :) * 1e-9};
|
||||
pair_three = {'PD in', round(dataTableGrpd_mean.power_pd_in(loopFiltGrpd, :), 2)};
|
||||
addDatatips(plt, pair_one, pair_two, pair_three);
|
||||
|
||||
|
||||
|
||||
% Optionally: outline bounds for better visibility (optional)
|
||||
% hnew = outlinebounds(hl, hp);
|
||||
|
||||
% Tick marks (x-axis)
|
||||
xticks(round(unique(x_values),2));
|
||||
|
||||
% Optional: scatter realizations
|
||||
if plotRealizations
|
||||
loopFiltSingle = dataTable.(loop_var) == loopValue;
|
||||
x_single = double(dataTable.(x_var)(loopFiltSingle, :));
|
||||
y_single = double(dataTable.(y_var)(loopFiltSingle, :));
|
||||
|
||||
sc = scatter(x_single, y_single, 'Marker', mkr, 'MarkerEdgeColor', cols(i, :), ...
|
||||
'LineWidth', 0.5, 'HandleVisibility', 'off', 'DisplayName', string(dispname));
|
||||
|
||||
pair_one = {'Run ID', dataTable.run_id(loopFiltSingle, :)};
|
||||
pair_two = {'Rate', dataTable.bitrate(loopFiltSingle, :) * 1e-9};
|
||||
pair_three = {'PD in', round(dataTable.power_pd_in(loopFiltSingle, :), 2)};
|
||||
addDatatips(sc, pair_one, pair_two, pair_three);
|
||||
end
|
||||
end
|
||||
|
||||
% Label axes and title
|
||||
legend('Interpreter', 'latex');
|
||||
xlabel(x_var);
|
||||
ylabel(y_var);
|
||||
title([x_var, ' vs. ', y_var]);
|
||||
|
||||
if string(y_var) == "BER"
|
||||
yline(4e-4, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
yline(3.8e-3, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
yline(2e-2, 'LineWidth', 1, 'LineStyle', '--', 'HandleVisibility', 'off');
|
||||
ylim([1e-5, 0.1]);
|
||||
end
|
||||
|
||||
xlim([13,35]);
|
||||
|
||||
% Enable grid and beautify
|
||||
grid on;
|
||||
beautifyBERplot;
|
||||
|
||||
|
||||
|
||||
|
||||
function resultTable = groupIt(fixedVars, dataTable, aggregationFunction)
|
||||
% groupIt Groups data in a table based on fixedVars and applies aggregationFunction to numeric data.
|
||||
@@ -463,9 +534,9 @@ for groupIdx = 1:height(groupKeys)
|
||||
continue;
|
||||
end
|
||||
|
||||
% Detect outliers in log space
|
||||
% Detect outliers in log space
|
||||
y_log = log10(y_values);
|
||||
outlierMask = isoutlier(y_log, 'quartiles'); % or 'median', 'grubbs', etc.
|
||||
outlierMask = isoutlier(y_log, 'quartiles',1); % or 'median', 'grubbs', etc.
|
||||
|
||||
% If any outliers found, collect their data
|
||||
if any(outlierMask)
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor_plain.db'],"type",'sqlite');
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.no_db), ...
|
||||
'db_mode', [], ...
|
||||
'fiber_length', 1, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 1, ...
|
||||
'is_mpi', 0, ...
|
||||
'pam_level', 4, ...
|
||||
'rop_attenuation', 0, ...
|
||||
'wavelength', 1310 ...
|
||||
);
|
||||
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.no_db);
|
||||
filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
% filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
% filterParams.EqualizerParameters.DCmu = 0.005;
|
||||
|
||||
selectedFields = {'Configurations.run_id' 'Runs.rx_raw_path' 'Configurations.bitrate' 'Configurations.symbolrate' 'Configurations.pam_level' 'Configurations.db_mode' 'Configurations.rop_attenuation' 'Configurations.is_mpi' 'Configurations.interference_attenuation' 'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'Measurements.power_pd_in' 'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.SNR' 'Results.GMI' 'Results.Alpha'};
|
||||
% selectedFields = {'Configurations.run_id'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db'],"type",'sqlite');
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.db_encoded), ...
|
||||
'fiber_length', 10, ...
|
||||
'db_mode', [], ...
|
||||
'fiber_length', 1, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 0, ...
|
||||
@@ -18,11 +18,11 @@ filterParams.Configurations = struct( ...
|
||||
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.db_encoded);
|
||||
% filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
filterParams.EqualizerParameters.DCmu = 0.00;
|
||||
% filterParams.EqualizerParameters.DCmu = 0.00;
|
||||
|
||||
selectedFields = {'Configurations.run_id' 'Runs.rx_raw_path' 'Configurations.bitrate' 'Configurations.symbolrate' 'Configurations.pam_level'...
|
||||
'Configurations.db_mode' 'Configurations.rop_attenuation' 'Configurations.is_mpi' 'Configurations.interference_attenuation' ...
|
||||
'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'Measurements.power_pd_in' ...
|
||||
'EqualizerParameters.equalizer_structure' 'EqualizerParameters.diff_precode' 'EqualizerParameters.eq_id' 'EqualizerParameters.DCmu' 'Measurements.power_pd_in' ...
|
||||
'Measurements.power_mpi_interference' 'Measurements.power_mpi_signal' 'Results.BER' 'Results.BER_precoded' 'Results.SNR' 'Results.GMI' 'Results.Alpha' 'Results.date_of_processing'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db'],"type",'sqlite');
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', 450e9, ... %[224,336,360,390,420,448]
|
||||
'bitrate', 420e9, ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.no_db), ...
|
||||
'fiber_length', 10, ...
|
||||
'interference_attenuation', [], ...
|
||||
|
||||
117
projects/Job_Processing/run_offline_dsp.m
Normal file
117
projects/Job_Processing/run_offline_dsp.m
Normal file
@@ -0,0 +1,117 @@
|
||||
% === 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;
|
||||
Reference in New Issue
Block a user