PPG_EVA_tool module

Created on Thu Jan 16 14:37:23 2025

@author: alko18

PPG_EVA_tool.preprocessing(signal_directory, TN, plot=True)

The preprocessing pipeline. Starting with the signalimport. It continues with the filtering and slicing into chunks. Returns a object containing all SQIs.

Parameters

signal_directorystring

The baspath to signaldirectory. In that directory, only signals in .txt-format are allowed.

TNstring

The TN-ID to find the signals within the signal_directory. The IDs are provided by the os.listdir()-funktion. Therefore The ID is synonymous for the filename.

plotbool, optional

If True, the continous signal will be plotted. The chunks will be seperated by dashed lines. The default is True.

PPG_EVA_tool.process(stop_event, train=False, testrun=False)

The main funktion. Here it is decided wether PPG-Eva is in trainingmode or not.

Parameters

stop_event: objekt

Provides a stop event so PPG-Eva can be aborted while running. For convenience purpose.

trainbool, optional

If False, PPG-Eva is in Evaluationmode. It starts with importing all filenames from the given directory and the classifier. Then it iterates over all elements in TN_list. The preprocessing is provided by PPG_EVA_tool.preprocessing(). After that, it creates a binary scoring and wraps the data into a dictionairy.

final_resultdict

The Evaluation of each signal. It gives the number of good chunks, bad chunks, the number of all chunks, and the proportion of the number of bad chunks to all chunks. Example:

final_result[name] = {
                      'good': good_chunks, 
                      'bad': bad_chunks, 
                      'sum': sum_, 
                      'bad/sum': bad_chunks/sum_
                      }

Otherwise it is in trainingmode. It needs a datafile and a annotationfile. The filepath to these two are set while installation. For more info, got to the PPG_EVA_GUI.set_values() docs. While processing, the ROC-curves of the 5 subsets will be plottet. Further the performance of the classifier on the five subsets and on the testset will be shown in ROC-space. There will be a prompt in the kernel asking wether to save [s] the classifier, start over [n] or quit [q]. The default is False.

testrunbool, optional

For evaluationmode only. It takes the first signal from the directory and process it to check for errors. The default is False.