More focus on Database analysis and direct DSP'ing of run_id's
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
|
||||
% 1) Find RUN ID's
|
||||
|
||||
basePath = 'C:\Users\Silas\Documents\MATLAB\Datensätze\sioe_labor\';
|
||||
database = DBHandler("pathToDB",[basePath,'silas_labor.db']);
|
||||
|
||||
filterParams = database.tables;
|
||||
filterParams.Configurations = struct( ...
|
||||
'bitrate', [], ... %[224,336,360,390,420,448]
|
||||
'db_mode', [], ...
|
||||
'fiber_length', [], ...
|
||||
'interference_attenuation',[], ...
|
||||
'is_mpi', 0, ...
|
||||
'pam_level', [], ...
|
||||
'rop_attenuation', 0 ...
|
||||
);
|
||||
|
||||
selectedFields = {'Runs.run_id',...
|
||||
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength',...
|
||||
'Configurations.precomp_amp','Measurements.power_rop','Measurements.power_pd_in','Configurations.v_bias','Configurations.is_mpi',...
|
||||
'Configurations.interference_attenuation','Configurations.rop_attenuation'};
|
||||
|
||||
[dataTable,sql_query] = database.queryDB(filterParams, selectedFields);
|
||||
|
||||
% only the rows without BER so far
|
||||
% dataTable = dataTable(dataTable.BER == 0,:);
|
||||
dataTable = dataTable((dataTable.fiber_length ~= 1),:);
|
||||
|
||||
% Ensure a parallel pool is running
|
||||
pool = gcp('nocreate');
|
||||
if isempty(pool)
|
||||
pool = parpool;
|
||||
% stop all forgotten or unfetched jobs from queue
|
||||
elseif ~isempty(pool.FevalQueue.QueuedFutures) || ~isempty(pool.FevalQueue.RunningFutures)
|
||||
oldq = length(pool.FevalQueue.QueuedFutures) + length(pool.FevalQueue.RunningFutures);
|
||||
pool.FevalQueue.cancelAll
|
||||
fprintf('Canceled %d unfetched jobs from old queue.', oldq);
|
||||
end
|
||||
|
||||
% Number of tasks to submit (one per run_id)
|
||||
nTasks = height(dataTable);
|
||||
futures = parallel.FevalFuture.empty();
|
||||
|
||||
% Submit each DSP run as a parallel task using parfeval
|
||||
for i = 1:nTasks
|
||||
% Extract the run_id (other parameters could be passed if needed)
|
||||
runID = dataTable.run_id(i);
|
||||
% Submit the function call to dsp_run_id (assuming it returns no output, hence 0 outputs)
|
||||
futures(i) = parfeval(pool, @dsp_run_id, 0, runID, "max_occurences", 15, "append_to_db", 1);
|
||||
end
|
||||
|
||||
% Set up a waitbar to monitor progress
|
||||
h = waitbar(0, 'Processing DSP runs...');
|
||||
while ~all(strcmp({futures.State}, 'finished'))
|
||||
finishedCount = sum(strcmp({futures.State}, 'finished'));
|
||||
waitbar(finishedCount / nTasks, h);
|
||||
pause(0.1);
|
||||
end
|
||||
delete(h);
|
||||
|
||||
fprintf('All DSP runs processed.\n');
|
||||
Reference in New Issue
Block a user