eva_classes module
- class eva_classes.Processing(signals, timestamps)
Bases:
object
The class for processing the Signals. It takes the signal as an array and the timestamps as a pandas.Series objekt. Included are:
pleth_filter
resampling
slice_list
- pleth_filter(fs, lowcut, highcut, order, resampled=False)
Butterwoth IIR filter. It takes the signal and filters it in a second order section mannor. If the signal was resampled with Processing.resampled, resampled must be set True. The filtered signal is stored in self.filtered_signal.
Parameters
- fs_AInt
Sampling rate in Hertz. The samplingrate is provided with the config.ini. For more information on that go to PPG_EVA_GUI.set_values().
- lowcutfloat, optional
The lower bound of the Filter. It is provided with the config.ini.
- highcutfloat, optional
The higher bound of the Filter. It is provided with the config.ini.
- orderInt, optional
The order of the Filter. It is provided with the config.ini. Keep in mind that due to forward-backwards filtering the effektive order doubles.
- resampledBool, optional
Wether the Signal is resampled or not. the resampled signal is a different attribute of this object. The default is False.
- resampling(sampling_rate, target_rate=128, interpolate_pchip=False)
A function to resample a signal. It can be resampled with the C2-spline-interpolation method or the pchip method. This funktion is essentially deprecated but can still be used by modifying the PPG_EVA_tool.preprocessing funktion. The resampled signal and timestamps is stored in the self.resample_signal and self.new_timestamps atributes respectivley.
Parameters
- sampling_rateInt
The original smaplingrate of the signal.
- target_rate: Int
The target samplingrate of the signal. This parameter is provided by the config.ini as fs_A.
- interpolate_pchip: bool
if True, the resampling is performed by the pchip-method. The default is False and hence C2-Splineinterpolation is used.
- class eva_classes.SQI(signal_chunks)
Bases:
object
The class to calculate all SQIs. To initialize it takes only a 2D-array of the signalchunks. Includes:´
shanon_entropy
calc_SNR
ZCR
skewness
kurt
- ZCR()
Calculate the ZCR for every sequence. The ZCR is here defined as the variance to a lin. Regression of the time of occurance of every signchange. The lin. Regression is performed with the eva_toolkit.lin_reg() function and the variance is calculated by the eva_toolkit.variance() function.
Returns
- self.signs: list
A list with values for the signs of the signalvalues.
1 = positive
-1 = negative
- self.cross_pos: list
A list of the indices where a zero crossing occured.
- self.n_cross: Int
The number of zero crossings.
- self.slope: float
the slope of the lin. regression for every sequence.
- self.intersect: float
the y-intersect of the lin. regression for every sequence.
- self.variance:
the variance for every sequence.
- calc_SNR(lowcut=0.8, highcut=2.0)
Calculates the Signal- to Noise-Ratio. Defined as the relative power of a signalband to the rest. To determine the signalpower, the FFT of the given chunk is integrated within the lowcut and highcut as lower and upper limits respectivley. The noisepower is the integrates value of the FFT outside these boundaries.
Parameters
- lowcutfloat, optional
Lower bound of the frequency band. This parameter is provided by the config.ini as bpm.
- highcutfloat, optional
higher bound of the frequency band. This parameter is provided by the config.ini as bpm.
Returns
- self.SNR: list
The SNR-values for every sequence.
- self.freq: list
the frequencies for every sequence.
- self.magnitude: list
the magnitudes of the frequencies for every sequence.
- kurt()
Calculates the kurtosis for every sequence.
Returns
- self.kurt: list
The kurtosis for every sequence.
- shanon_entropy(num_bins=16)
Calculates the normalised entropy for every sequence. The entropy for every chunk is stored in a array in the self.entropy_values atribute.
Parameters
- num_binsInt, optional
The number of bins used to create the histogram and therefore the probability density function. The default is 16.
- class eva_classes.Training(skew_values, kurt_values, data)
Bases:
object
The class for Training. It takes the skewness, and kurtosis as separate arrays and the anotation as a list or array as a binary classification.
Includes:
separate_values
building hists
- building_hists(plot=False)
Builds a 2D probability densitifunction where the skewness and the kurtosis the two dimensions resemble. The resulting PDF is a logarithmic difference of the PDFs of the good data and the bad data.
Parameters
- plotbool, optional
If True, all PDFs will be plotted. The default is False.
Returns
- self.hist: aray
The PDF-values.
- self.xedges: array
The xedges of the bins.
- self.yedges: array
The yedges of the bins.
- separate_values()
Separating the values in good and bad data according to the annotation.
Returns
- self.positive_skew: array
All skewness values that are labeled as good.
- self.positive_kurt: array
All kurtosis values that are labeled as good.
- self.negative_skew: array
All skewness values that are labeled as bad.
- self.negative_kurt: array
All kurtosis values that are labeled as bad.