Many changes for 400G DSP

Minimal Example
...
This commit is contained in:
sioe
2024-12-17 16:17:58 +01:00
parent 397cfa61dd
commit e47a4dbbbe
68 changed files with 2749 additions and 2948 deletions

View File

@@ -17,18 +17,56 @@ folderNames = folderNames(~ismember(folderNames, {'.', '..'}));
% Combine folder names with paths
fullFolderPaths = flip(fullfile(folderPaths, folderNames));
only_mpi=0;
% process only MPI?
only_mpi=0;
if only_mpi
fullFolderPaths = fullFolderPaths(contains(fullFolderPaths,"mpi"));
end
relativeFolderPaths = strrep(fullFolderPaths, sioe_labor_path, '');
% Shorten folder paths to display only the folder name after the last filesep
displayFolderPaths = cellfun(@(x) x(find(x == filesep, 1, 'last') + 1 : end), fullFolderPaths, 'UniformOutput', false);
% Create checkbox settings for each folder path
numFolders = numel(fullFolderPaths);
checkboxSettings = cell(1, 2 * numFolders);
for i = 1:numFolders
checkboxSettings{2*i-1} = {displayFolderPaths{i}; sprintf('Folder_%d', i)};
checkboxSettings{2*i} = true; % Set false for unchecked by default
end
% Create settings dialog using settingsdlg
[settings, button] = settingsdlg( ...
'Description', 'Select Folders to Process:', ...
'title', 'Folder Selection', ...
checkboxSettings{:});
% Check if the user pressed OK
if strcmp(button, 'OK')
% Get all the field names from settings
allFields = fieldnames(settings);
% Determine which folders were selected
selectedFoldersIdx = cellfun(@(x) settings.(x), allFields);
% Get the list of selected folders
selectedFolders = fullFolderPaths(selectedFoldersIdx==1);
% Display the selected folders
fprintf('Selected Folders to Process:\n');
disp(selectedFolders);
else
fprintf('No folders selected.\n');
end
relativeFolderPaths = strrep(selectedFolders, sioe_labor_path, '');
disp(['Start to process ',num2str(numel(relativeFolderPaths)), ' folder in the directory']);
for f = 1:numel(fullFolderPaths)
folder = fullFolderPaths{f};
for f = 1:numel(selectedFolders)
folder = selectedFolders{n};
relfolder = relativeFolderPaths{f};
@@ -106,18 +144,18 @@ for f = 1:numel(fullFolderPaths)
params_merge = struct;
for c = 1:numel(big_wh_list)
fnames = fieldnames(big_wh_list{c}.parameter);
for f = 1:numel(fnames)
for fn = 1:numel(fnames)
% Initialize field if not already present
if ~isfield(params_merge, fnames{f})
params_merge.(fnames{f}) = [];
if ~isfield(params_merge, fnames{fn})
params_merge.(fnames{fn}) = [];
end
% Merge unique parameter values into params_merge
a = big_wh_list{c}.parameter.(fnames{f}).values;
b = params_merge.(fnames{f});
a = big_wh_list{c}.parameter.(fnames{fn}).values;
b = params_merge.(fnames{fn});
vals_to_add = setdiff(a, b); % New values in a that aren't in b
b = sort([b, vals_to_add]); % Combine and sort values
params_merge.(fnames{f}) = b;
params_merge.(fnames{fn}) = b;
end
end
@@ -157,11 +195,11 @@ for f = 1:numel(fullFolderPaths)
isMPI = isfield(measurementStruct,'i_power');
% Process record if it contains data
% Process record if it contains *any* data
if recordIsFilled
if ~isMPI
% Generate filenames with conditionally formatted parameters
% Format the L parameter value (show decimal only if non-zero)
if configStruct.lambda == floor(configStruct.lambda)
@@ -175,8 +213,13 @@ for f = 1:numel(fullFolderPaths)
configStruct.M, L_str, configStruct.bitrate, configStruct.duobinary, 0);
fbody_tx = strrep(fbody_tx, '.', '_'); % Replace decimal point with underscore
fbody_rx = sprintf('%s_PAM_%d_L_%s_R_%d_DB_%d_ROP_%d', datebody, ...
configStruct.M, L_str, configStruct.bitrate, configStruct.duobinary, configStruct.rop_atten);
if configStruct.rop_atten == round(configStruct.rop_atten)
fbody_rx = sprintf('%s_PAM_%d_L_%s_R_%d_DB_%d_ROP_%d', datebody, ...
configStruct.M, L_str, configStruct.bitrate, configStruct.duobinary, configStruct.rop_atten);
else
fbody_rx = sprintf('%s_PAM_%d_L_%s_R_%d_DB_%d_ROP_%.1f', datebody, ...
configStruct.M, L_str, configStruct.bitrate, configStruct.duobinary, configStruct.rop_atten);
end
fbody_rx = strrep(fbody_rx, '.', '_');
elseif isMPI
@@ -185,8 +228,13 @@ for f = 1:numel(fullFolderPaths)
configStruct.M, configStruct.bitrate, configStruct.duobinary, 0);
fbody_tx = strrep(fbody_tx, '.', '_'); % Replace decimal point with underscore
fbody_rx = sprintf('%s_PAM_%d_R_%d_DB_%d_I_atten_%d', datebody, ...
configStruct.M, configStruct.bitrate, configStruct.duobinary, configStruct.interference_atten);
if configStruct.interference_atten == round(configStruct.interference_atten)
fbody_rx = sprintf('%s_PAM_%d_R_%d_DB_%d_I_atten_%d', datebody, ...
configStruct.M, configStruct.bitrate, configStruct.duobinary, configStruct.interference_atten);
else
fbody_rx = sprintf('%s_PAM_%d_R_%d_DB_%d_I_atten_%.1f', datebody, ...
configStruct.M, configStruct.bitrate, configStruct.duobinary, configStruct.interference_atten);
end
fbody_rx = strrep(fbody_rx, '.', '_'); % Replace decimal point with underscore
end
@@ -223,6 +271,7 @@ for f = 1:numel(fullFolderPaths)
% SYNCHRONIZED RX SIGNAL
fn_rxtsynch = [filesep, fbody_rx, '_rx_signal.mat'];
fp_rxtsynch = fullfile([folder, fn_rxtsynch]);
fn_rxtsynch_rel = [];
if exist(fp_rxtsynch, "file") == 2
fn_rxtsynch_rel = [relfolder, fn_rxtsynch];
@@ -244,13 +293,42 @@ for f = 1:numel(fullFolderPaths)
end
end
end
elseif exist(fp_rxtsynch, "file") == 0
disp(['RX Signal not found at: ', fn_rxtsynch,' generate and save new one using symbols and raw signal']);
Scpe_sig_raw = load(fp_rxraw);
Scpe_sig_raw = Scpe_sig_raw.Scpe_sig_raw;
Symbols = load(fp_symbols);
Symbols = Symbols.Symbols;
%%%%%% Sample to 2x fsym %%%%%%
Scpe_sig_resampled = Scpe_sig_raw.resample("fs_in",Scpe_sig_raw.fs,"fs_out",2*Symbols.fs);
%%%%%% Sync Rx signal with reference (S is a cell array with all occurences) %%%%%%
[Scpe_sig_syncd,S,isFlipped] = Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",Symbols.fs);
%%%%% Plot and Save Routines: SAVE RECEIVED SIGNALS %%%%%%%%%%%%%%%%%%%%%%%%%
save(fp_rxtsynch,"S");
if exist(fp_rxtsynch, "file") == 0
warndlg('Something still wromg... No rx file here but we just generated it from raw signal');
end
fn_rxtsynch_rel = [relfolder, fn_rxtsynch];
elseif missing_raw_flag
warning(['RX Signal not found at: ', fn_rxtsynch]);
warndlg('No RAW or RX signal found! This is bad!');
% look at measurementStruct and configStruct
end
else
disp('Record not filled?')
% look at measurementStruct and configStruct
end
% Call the duplicate check function
exists = db.checkIfRunExists('Runs', 'rx_sync_path', fn_rxtsynch_rel);
if ~isempty(fn_rxtsynch_rel)
exists = db.checkIfRunExists('Runs', 'rx_sync_path', fn_rxtsynch_rel);
end
if ~exists
@@ -335,31 +413,32 @@ for f = 1:numel(fullFolderPaths)
% Append the new row to the Measurements table
db.appendToTable('Measurements', newMeas);
% Table 4: Append to Bers
[ber, structure, settings] = getBers(configStruct,measurementStruct);
for t = 1:numel(ber)
if iscell(ber(t))
ber_ = ber(t);
ber_ = ber_{1};
else
ber_ = ber(t);
end
if ber_~=-1
newBer = struct(...
'ber_id', NaN,...
'run_id', run_id,...
'processing_structure', structure(t),...
'processing_settings', settings(t),...
'ber', jsonencode(ber_)...
);
db.appendToTable('BERs', newBer);
end
end
% % Table 4: Append to Bers
% [ber, structure, settings] = getBers(configStruct,measurementStruct);
% for t = 1:numel(ber)
%
% if iscell(ber(t))
% ber_ = ber(t);
% ber_ = ber_{1};
% else
% ber_ = ber(t);
% end
%
% if ber_~=-1
%
% newBer = struct(...
% 'ber_id', NaN,...
% 'run_id', run_id,...
% 'processing_structure', structure(t),...
% 'processing_settings', settings(t),...
% 'ber', jsonencode(ber_)...
% );
%
% db.appendToTable('BERs', newBer);
%
% end
%
% end
end