dupin.preprocessing.signal#

Overview

fft_smoothing

Smooth out the highest frequencies of a signal.

moving_average

Smooth an array via a moving average.

Details

Functions for smoothing a signal.

scipy.signal provides many additional methods for signal processing that can be used to transform data in numerous ways.

dupin.preprocessing.signal.fft_smoothing(y, max_frequency, sampling_frequency, **kwargs)[source]#

Smooth out the highest frequencies of a signal.

Parameters:
  • y (\((N, M)\) numpy.ndarray of float) – The signal to remove low contributing frequencies from. The FFT is performed on the first dimension.

  • max_frequency (float) – The maximum frequency in the signal to allow. The unit for frequency must be consistent with sampling_frequency.

  • sampling_frequency (float) – The sampling frequency. The unit for frequency must be consistent with max_frequency.

  • **kwargs – Key word arguments to pass to scipy.signal.ellip.

dupin.preprocessing.signal.moving_average(y, span=1)[source]#

Smooth an array via a moving average.

For multidimensional arrays, the smoothing is done on the first axis. This is consistent when columns represent multiple variables or features and rows represent different instances.

Parameters:
  • y (numpy.ndarray) – input array to smooth.

  • span (int, optional) – The window size to compute the moving mean over. Defaults to 1 which does nothing.

Returns:

smoothed_array

Return type:

numpy.ndarray