qumphy.data.signal_preprocessing.filters module

File: qumphy/data/signal_preprocessing/filters.py Project: 22HLT01 QUMPHY Contact: oskar.pfeffer@ptb.de Gitlab: https://gitlab.com/qumphy Description: Functions for filtering the signals.

qumphy.data.signal_preprocessing.filters.apply_filter(signal, filter_params)[source]

Applies a filter to the input signal.

Return type:

ndarray

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

  • filter_params (dict) – A dictionary containing the filter parameters.

Returns:

filtered_signal – The filtered signal.

Return type:

np.ndarray

qumphy.data.signal_preprocessing.filters.bandpass_filter(signal, lowcut, highcut, signal_frequency, order=4)[source]

Applies a Butterworth band-pass filter to the input signal.

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

  • lowcut (float) – The lower bound of the frequency range to be filtered out.

  • highcut (float) – The upper bound of the frequency range to be filtered out.

  • signal_frequency (float) – The sampling frequency of the signal.

  • order (int, optional) – The order of the filter. Defaults to 4.

Returns:

filtered_signal – The filtered signal.

Return type:

np.ndarray

qumphy.data.signal_preprocessing.filters.highpass_filter(signal, cutoff, signal_frequency, order=4)[source]

Applies a Butterworth high-pass filter to the input signal.

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

  • cutoff (float) – The frequency below which the signal should be filtered out.

  • signal_frequency (float) – The sampling frequency of the input signal.

  • order (int, optional) – The order of the filter. Defaults to 4.

Returns:

filtered_signal – The filtered signal.

Return type:

np.ndarray

qumphy.data.signal_preprocessing.filters.lowpass_filter(signal, cutoff, signal_frequency, order=4)[source]

Applies a Butterworth low-pass filter to the input signal.

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

  • cutoff (float) – The frequency above which the signal should be filtered out.

  • signal_frequency (float) – The sampling frequency of the input signal.

  • order (int, optional) – The order of the filter. Defaults to 4.

Returns:

filtered_signal – The filtered signal.

Return type:

np.ndarray