lab_driver.process_data#

Module Contents#

Classes#

Functions#

window_method

Generating window for smoothing transformation method.

do_fft

Performing the Discrete Fast Fourier Transformation.

API#

lab_driver.process_data.window_method(window_size: int, method: str = 'hamming') numpy.ndarray[source]#

Generating window for smoothing transformation method.

Parameters:
  • window_size – Integer number with size of the window

  • method – Selection of window method [‘’: None, ‘Hamming’, ‘guassian’, ‘bartlett’, ‘blackman’]

Returns:

Numpy array with window

lab_driver.process_data.do_fft(y: numpy.ndarray, fs: float, method_window: str = '') [numpy.ndarray, numpy.ndarray][source]#

Performing the Discrete Fast Fourier Transformation.

Parameters:
  • y – Transient input signal

  • fs – Sampling rate [Hz]

  • method_window – Selected window [‘’: None, ‘Hamming’, ‘guassian’, ‘bartlett’, ‘blackman’]

Returns:

Tuple with (1) freq - Frequency and (2) Y - Discrete output

class lab_driver.process_data.MetricCalculator[source]#

Bases: lab_driver.process_common.ProcessCommon

Initialization

Class with constructors for processing the measurement results for extracting device-specific metrics

calculate_lsb_mean(stim_input: numpy.ndarray, daq_output: numpy.ndarray) float[source]#

Function for calculating the mean Least Significant Bit (LSB)

Parameters:
  • stim_input – Numpy array with stimulus input

  • daq_output – Numpy array with DAQ output

Returns:

Float with LSB

static calculate_lsb(stim_input: numpy.ndarray, daq_output: numpy.ndarray) numpy.array[source]#

Function for calculating the mean Least Significant Bit (LSB)

Parameters:
  • stim_input – Numpy array with stimulus input

  • daq_output – Numpy array with DAQ output

Returns:

Float with LSB

calculate_dnl(stim_input: numpy.ndarray, daq_output: numpy.ndarray) numpy.ndarray[source]#

Calculating the Differential Non-Linearity (DNL) of a transfer function from DAC/ADC

Parameters:
  • stim_input – Numpy array with stimulus input

  • daq_output – Numpy array with DAQ output

Returns:

Numpy array with DNL

abstractmethod static calculate_inl(stim_input: numpy.ndarray, daq_output: numpy.ndarray) numpy.ndarray[source]#

Calculating the Integral Non-Linearity (INL) of a transfer function from DAC/ADC

Parameters:
  • stim_input – Numpy array with stimulus input

  • daq_output – Numpy array with DAQ output

Returns:

Numpy array with INL

static calculate_error_mbe(y_pred: numpy.ndarray | float, y_true: numpy.ndarray | float) float[source]#

Calculating the distance-based metric with mean bias error

Parm y_pred:

Numpy array or float value from prediction

Parameters:

y_true – Numpy array or float value from true label

Returns:

Float value with error

static calculate_error_mae(y_pred: numpy.ndarray | float, y_true: numpy.ndarray | float) float[source]#

Calculating the distance-based metric with mean absolute error

Parameters:
  • y_pred – Numpy array or float value from prediction

  • y_true – Numpy array or float value from true label

Returns:

Float value with error

static calculate_error_mse(y_pred: numpy.ndarray | float, y_true: numpy.ndarray | float) float[source]#

Calculating the distance-based metric with mean squared error

Parameters:
  • y_pred – Numpy array or float value from prediction

  • y_true – Numpy array or float value from true label

Returns:

Float value with error

static calculate_error_mape(y_pred: numpy.ndarray | float, y_true: numpy.ndarray | float) float[source]#

Calculating the distance-based metric with mean absolute percentage error

Parameters:
  • y_pred – Numpy array or float value from prediction

  • y_true – Numpy array or float value from true label

Returns:

Float value with error

static calculate_total_harmonics_distortion(signal: numpy.ndarray, fs: float, N_harmonics: int) float[source]#

Calculating the Total Harmonics Distortion (THD) of transient input

Parameters:
  • signal – Numpy array with transient signal to extract spectral analysis

  • fs – Applied sampling rate [Hz]

  • N_harmonics – Number of used harmonics for calculating THD

Returns:

THD value (in dB)

static calculate_cosine_similarity(y_pred: numpy.ndarray, y_true: numpy.ndarray) float[source]#

Calculating the Cosine Similarity of two different inputs (same size)

Parameters:
  • y_pred – Numpy array or float value from prediction

  • y_true – Numpy array or float value from true label

Returns:

Float value with error