function output = dsp_runid(run_id, options) arguments run_id options.append_to_db = 0; options.max_occurences = 4; options.start_occurence = 1; options.userParameters = struct(); options.database_type options.dataBase options.server = "134.245.243.254"; options.port = 3306; options.user = "silas"; options.password = "silas"; options.load_file_path = struct(); options.storage_path options.mode options.recipe = @dsp_scope_signal; options.debug_plots (1,1) logical = false; end try output = initializeOutput(); database = []; inputSource = normalizeDspInputSource(options.mode); if inputSource == "run_id" || options.append_to_db database = DBHandler("dataBase", [options.dataBase], "type", options.database_type, ... "user", options.user, "password", options.password, ... "server", options.server, "port", options.port); end switch inputSource case "run_id" dspInput = loadDspInputFromRunId(run_id, database, options); case "file_paths" dspInput = loadDspInputFromFilePaths(run_id, options); end num_occurences = length(dspInput.Scpe_cell); for r = 1:num_occurences %%%%%%%% CORE EQUALIZATION CALL (Scpe, Symbols, Bits, 'Options') %%%%%%% dspOutput = options.recipe(dspInput.Scpe_cell{r}, dspInput.Symbols, dspInput.Tx_bits, ... "fsym", dspInput.fsym, ... "M", dspInput.M, ... "duob_mode", dspInput.duob_mode, ... "dataTable", dspInput.dataTable, ... "userParameters", options.userParameters, ... "debug_plots", options.debug_plots); %%%%%%%% CORE EQUALIZATION CALL %%%%%%% fieldNames = fieldnames(dspOutput); for fieldIdx = 1:numel(fieldNames) fieldName = fieldNames{fieldIdx}; output.(fieldName){r} = dspOutput.(fieldName); end if options.append_to_db appendDspOutputToDatabase(database, run_id, dspOutput); end end catch ME save('workerError.mat', 'ME'); rethrow(ME); end end function output = initializeOutput() output.ffe_package = {}; output.dfe_package = {}; output.mlse_package = {}; output.vnle_package = {}; output.dbtgt_package = {}; output.dbenc_package = {}; output.mlmlse_package = {}; end function inputSource = normalizeDspInputSource(mode) mode = string(mode); switch mode case {"load_run_id", "run_id"} inputSource = "run_id"; case {"load_files", "file_paths"} inputSource = "file_paths"; otherwise error('dsp_runid:UnsupportedMode', ... 'Mode "%s" is not supported. Use "run_id" or "file_paths".', mode); end end function appendDspOutputToDatabase(database, run_id, dspOutput) packageNames = fieldnames(dspOutput); for i = 1:numel(packageNames) package = dspOutput.(packageNames{i}); if isempty(package) continue end database.addProcessingResult(run_id, package.metrics, package.config); end end