More focus on Database analysis and direct DSP'ing of run_id's
This commit is contained in:
@@ -5,47 +5,67 @@ database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', 336e9, ...
|
||||
'db_mode', 0, ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', int32(db_mode.no_db), ...
|
||||
'fiber_length', 1, ...
|
||||
'interference_attenuation', [], ...
|
||||
'interference_path_length', [], ...
|
||||
'is_mpi', 1, ...
|
||||
'pam_level', 4, ...
|
||||
'rop_attenuation', 0 ...
|
||||
'rop_attenuation', 0, ...
|
||||
'wavelength', 1310 ...
|
||||
);
|
||||
|
||||
filterParams.EqualizerParameters.diff_precode = int32(db_mode.no_db);
|
||||
filterParams.EqualizerParameters.equalizer_structure = int32(equalizer_structure.vnle);
|
||||
% filterParams.EqualizerParameters.diff_precode = int32(db_mode.no_db);
|
||||
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'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
fixedVars = {'run_id','eq_id','bitrate'};
|
||||
resultTable = groupIt(fixedVars,dataTable);
|
||||
|
||||
dataTableGrpd = groupIt(fixedVars,dataTable);
|
||||
|
||||
|
||||
% Create a new figure
|
||||
figure(1);
|
||||
figure(3);
|
||||
hold on
|
||||
unique_rates = unique(resultTable.bitrate);
|
||||
unique_rates = unique(dataTable.bitrate);
|
||||
cols = linspecer(8);
|
||||
for i = 1:numel(unique_rates)
|
||||
|
||||
% Plot BER vs. interference_attenuation
|
||||
plot(resultTable.power_mpi_signal(resultTable.bitrate==unique_rates(i),:)-resultTable.power_mpi_interference(resultTable.bitrate==unique_rates(i),:), resultTable.BER(resultTable.bitrate==unique_rates(i),:), 'o-', 'LineWidth', 1.5);
|
||||
% plot(dataTableGrpd.power_mpi_signal(dataTableGrpd.bitrate==unique_rates(i),:)-dataTableGrpd.power_mpi_interference(dataTableGrpd.bitrate==unique_rates(i),:), dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:), '-', 'LineWidth', 0.5,'Color',cols(i,:));
|
||||
|
||||
if filterParams.Configurations.is_mpi
|
||||
sir = dataTable.power_mpi_signal(dataTable.bitrate==unique_rates(i),:)-dataTable.power_mpi_interference(dataTable.bitrate==unique_rates(i),:);
|
||||
ber = dataTable.BER(dataTable.bitrate==unique_rates(i),:);
|
||||
sc=scatter(dataTable.power_mpi_signal(dataTable.bitrate==unique_rates(i),:)-dataTable.power_mpi_interference(dataTable.bitrate==unique_rates(i),:), dataTable.BER(dataTable.bitrate==unique_rates(i),:), 'LineWidth', 0.5,'Marker','.','MarkerEdgeColor',cols(i+1,:));
|
||||
pair_one = {'Run ID', dataTable.run_id(dataTable.bitrate==unique_rates(i),:)};
|
||||
pair_two = {'Rate', dataTable.bitrate(dataTable.bitrate==unique_rates(i),:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
else
|
||||
sc=scatter(62*ones(size( dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:))), dataTableGrpd.BER(dataTableGrpd.bitrate==unique_rates(i),:), 'LineWidth', 0.5,'Marker','o','MarkerEdgeColor',cols(i,:),'MarkerFaceColor',cols(i,:));
|
||||
pair_one = {'Run ID', dataTableGrpd.run_id(dataTableGrpd.bitrate==unique_rates(i),:)};
|
||||
pair_two = {'Rate', dataTableGrpd.bitrate(dataTableGrpd.bitrate==unique_rates(i),:)};
|
||||
addDatatips(sc, pair_one, pair_two);
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
% Label the axes and add a title
|
||||
xlabel('Interference Attenuation');
|
||||
xlabel('SIR in dB');
|
||||
ylabel('BER');
|
||||
title('BER vs. Interference Attenuation');
|
||||
|
||||
title('BER vs. Signal to Interference Ratio');
|
||||
yline(3.8e-3,'LineWidth',1,'LineStyle','--','HandleVisibility','off');
|
||||
% Enable grid for better readability
|
||||
grid on;
|
||||
|
||||
beautifyBERplot;
|
||||
|
||||
ylim([1e-4 0.5]);
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +90,7 @@ function resultTable = groupIt(fixedVars,dataTable)
|
||||
colData = dataTable.(varNames{j});
|
||||
if isnumeric(colData)
|
||||
% For numeric data, compute the mean.
|
||||
aggData{i, j} = mean(colData(idx));
|
||||
aggData{i, j} = min(colData(idx));
|
||||
else
|
||||
% For non-numeric data, take the first entry.
|
||||
if iscell(colData)
|
||||
@@ -88,4 +108,43 @@ function resultTable = groupIt(fixedVars,dataTable)
|
||||
% Append the group count as a new column.
|
||||
resultTable.nRows = groupCount;
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function addDatatips(sc, varargin)
|
||||
% addDatatips Adds custom data tip rows to a scatter plot.
|
||||
%
|
||||
% addDatatips(sc, pair1, pair2, ...) adds one or more custom rows to the
|
||||
% data tip display of the scatter plot identified by sc.
|
||||
%
|
||||
% Each pair should be provided as a 1x2 cell array: {label, value}.
|
||||
% The value can be a scalar or a vector. If a vector is provided, its length
|
||||
% must match the number of scatter plot points.
|
||||
%
|
||||
% Example:
|
||||
% sc = scatter(x, y, 'LineWidth', 1.5, 'Marker', 'o');
|
||||
% pair_one = {'Attenuation', attenuationVector};
|
||||
% addDatatips(sc, pair_one);
|
||||
|
||||
numPoints = numel(sc.XData);
|
||||
|
||||
for k = 1:length(varargin)
|
||||
pair = varargin{k};
|
||||
|
||||
if ~iscell(pair) || numel(pair) ~= 2
|
||||
error('Each pair must be a 1x2 cell array: {label, value}.');
|
||||
end
|
||||
|
||||
label = pair{1};
|
||||
value = pair{2};
|
||||
|
||||
% If value is a vector, ensure its length is either 1 or equal to the number of scatter points.
|
||||
if isvector(value) && numel(value) ~= 1 && numel(value) ~= numPoints
|
||||
error('The vector for "%s" must be a scalar or have %d elements matching the scatter data points.', label, numPoints);
|
||||
end
|
||||
|
||||
% Create a new data tip row using the provided label and vector.
|
||||
newRow = dataTipTextRow(label, value);
|
||||
sc.DataTipTemplate.DataTipRows(end+1) = newRow;
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user