src.helpers.signal_processing.filtering module

This module offers helper functions for signal filtering.

They are important for the data-driven assessment, e.g. in the UNECE-R79 use case.

It includes the following filter functions: - butterworth_filter: Butterworth filter - moving_average_filter: moving average filter They are mainly based on numpy arrays for fast vectorized operations. See details in their respective documentations.

Contact person: Stefan Riedmaier Creation date: 17.06.2020 Python version: 3.8

src.helpers.signal_processing.filtering.butterworth_filter(quantity, filter_settings='GRVA', sample_rate=100)

This function applies a butterworth filter to a measured quantity.

The following pre-defined settings of the butterworth filter are available: - ‘GRVA’: Filter recommended in GRVA-04-09 (UNECE) - ‘NCAP’: Filter used in vehicle dynamics from NCAP - ‘VDA’: Filter used in VDA-Draft (FKT SA FAS UAG Workshop B1)

Parameters:
  • quantity (np.ndarray) – signal to be filtered

  • filter_settings (str) – (optional) pre-configured filter types

  • sample_rate (float) – (optional) sample rate of the signal

Returns:

filtered signal

Return type:

np.ndarray

src.helpers.signal_processing.filtering.moving_average_filter(quantity, sample_rate=100, sample_window_length=0.5)

This function applies a moving average filter to a measured quantity.

The implementation is based on the following stack overflow article: https://stackoverflow.com/questions/13728392/moving-average-or-running-mean/43200476#43200476

Parameters:
  • quantity (np.ndarray) – signal to be filtered

  • sample_rate (float) – (optional) sample rate of the signal

  • sample_window_length (float) – (optional) length of the moving average window

Returns:

filtered signal

Return type:

np.ndarray