dispel.providers.generic.preprocessing module#

Core functionalities to preprocess signal data.

class dispel.providers.generic.preprocessing.AmplitudeRangeFilter[source]#

Bases: LevelFilter

Filter aberrant signal amplitude.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed (‘accelerometer’, ‘gyroscope’).

  • max_amplitude – A float which is the maximum expected amplitude values.

  • min_amplitude – A float which is the minimum expected amplitude values.

  • columns – The columns onto which the detrending steps have to be applied.

__init__(data_set_id, max_amplitude, min_amplitude, columns=None)[source]#
Parameters:
  • data_set_id (str) –

  • max_amplitude (float) –

  • min_amplitude (float) –

  • columns (List[str] | None) –

filter(levels)[source]#

Filter levels with acceptable signal amplitude.

Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

repr()[source]#

Get representation of the filter.

class dispel.providers.generic.preprocessing.Detrend[source]#

Bases: Apply

A detrending preprocessing step according a given data set.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed (‘accelerometer’, ‘gyroscope’).

  • columns – The columns onto which the detrending steps have to be applied.

  • kwargs – Additional arguments that are passed to the process() function of each step. This allows to provide additional values, such as placeholder values in value definitions to the actual processing function.

__init__(data_set_id, columns=None, **kwargs)[source]#
Parameters:
  • data_set_id (str) –

  • columns (List[str] | None) –

class dispel.providers.generic.preprocessing.FilterPhysiologicalNoise[source]#

Bases: Apply

Apply a filter that will remove any physiological noise into a dataset.

This filter is a butterworth high-pass one.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed (‘accelerometer’, ‘gyroscope’).

  • columns – The columns onto which the filtering step has to be applied.

  • sampling_frequency – Optional the initial sampling frequency.

  • kwargs – Additional arguments that are passed to the process() function of each step. This allows to provide additional values, such as placeholder values in value definitions to the actual processing function.

Notes

The Butterwoth highpass filter is tuned as in [Martinez et. al. 2012]_ to remove physiological noise. The cut-off of is of 0.2HZ which is the standard breath frequency.

__init__(data_set_id, columns=None, sampling_frequency=None, **kwargs)[source]#
Parameters:
  • data_set_id (str) –

  • columns (List[str] | None) –

  • sampling_frequency (float | None) –

class dispel.providers.generic.preprocessing.FilterSensorNoise[source]#

Bases: Apply

Apply a filter that will remove any sensor noise into a given dataset.

This filter is a Savitzky-Golay one.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed (‘accelerometer’, ‘gyroscope’).

  • columns – The columns onto which the filtering step has to be applied.

  • kwargs – Additional arguments that are passed to the process() function of each step. This allows to provide additional values, such as placeholder values in value definitions to the actual processing function.

Notes

The Savitzky-Golay is tuned as in [Martinez et. al. 2012]_ to remove sensor noise and to smooth the signal. The windows size is thus set up to 41 points and the filter is of order-3.

__init__(data_set_id, columns=None, **kwargs)[source]#
Parameters:
  • data_set_id (str) –

  • columns (List[str] | None) –

class dispel.providers.generic.preprocessing.PreprocessingSteps[source]#

Bases: ProcessingStepGroup

A changing referential preprocessing step according a given data set.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed.

  • limb – The modality regarding if the exercise is upper or lower limb.

  • sensor – The modality regarding the type of sensor either accelerometer or gyroscope.

  • resample_freq – Optionally, the frequency to which resample the data during the resample step.

  • columns – Optionally, the columns on which the preprocessing steps need to be applied.

  • level_filter (dispel.processing.level.LevelFilter) – An optional LevelFilter to determine the levels to be transformed. If no filter is provided, all levels will be transformed. The level_filter also accepts str, LevelIds and lists of either and passes them to a LevelIdFilter for convenience.

__init__(data_set_id, limb, sensor, resample_freq=None, columns=None, level_filter=<DefaultLevelFilter: *>)[source]#
Parameters:
class dispel.providers.generic.preprocessing.RotateFrame[source]#

Bases: ProcessingStepGroup

A changing referential preprocessing step according a given data set.

Parameters:
  • data_set_id – The data set id on which the transformation is to be performed.

  • gravity_data_set_id – The dataset id containing the gravity components.

  • frame – The new desired frame.

  • columns – The columns onto which the resampling steps have to be applied.

  • kwargs (Dict[str, Any]) – Additional arguments that are passed to the process() function of each step. This allows to provide additional values, such as placeholder values in value definitions to the actual processing function.

__init__(data_set_id, gravity_data_set_id, frame, columns=None, **kwargs)[source]#
Parameters: