biosppy.signals.acc

biosppy.signals.acc

This module provides methods to process Acceleration (ACC) signals. Implemented code assumes ACC acquisition from a 3 orthogonal axis reference system.

copyright:
  1. 2015-2026 by Instituto de Telecomunicacoes

license:

BSD 3-clause, see LICENSE for more details.

Authors: Afonso Ferreira Diogo Vieira

Functions

acc([signal, sampling_rate, units, path, ...])

Process a raw ACC signal and extract relevant signal features using default parameters.

activity_index([signal, sampling_rate, ...])

Compute the activity index of an ACC signal.

frequency_domain_feature_extractor([signal, ...])

Extracts the FFT from each ACC sub-signal (x, y, z), given the signal itself.

time_domain_feature_extractor([signal])

Extracts the vector magnitude and signal magnitude features from an input ACC signal, given the signal itself.

biosppy.signals.acc.acc(signal=None, sampling_rate=100.0, units=None, path=None, show=True, interactive=False)[source]

Process a raw ACC signal and extract relevant signal features using default parameters.

Parameters:
  • signal (array) – Raw ACC signal.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • units (str, optional) – The units of the input signal. If specified, the plot will have the y-axis labeled with the corresponding units.

  • path (str, optional) – If provided, the plot will be saved to the specified file.

  • show (bool, optional) – If True, show a summary plot.

  • interactive (bool, optional) – If True, shows an interactive plot.

Returns:

  • ts (array) – Signal time axis reference (seconds).

  • signal (array) – Raw (unfiltered) ACC signal.

  • vm (array) – Vector Magnitude feature of the signal.

  • sm (array) – Signal Magnitude feature of the signal.

  • freq_features (dict) – Positive Frequency domains (Hz) of the signal.

  • amp_features (dict) – Normalized Absolute Amplitudes of the signal.

biosppy.signals.acc.activity_index(signal=None, sampling_rate=100.0, window_1=5, window_2=60)[source]

Compute the activity index of an ACC signal. Follows the method described in [Lin18], the activity index is computed as follows: 1) Calculate the ACC magnitude if the signal is triaxial 2) Calculate the standard deviation of the ACC magnitude for each ‘window_1’ seconds 3) The activity index will be the mean standard deviation for each ‘window_2’ seconds

Parameters:
  • signal (array) – Raw ACC signal.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • window_1 (int, float, optional) – Window length (seconds) for the first moving average filter. Default: 5

  • window_2 (int, float, optional) – Window length (seconds) for the second moving average filter. Default: 60

Returns:

  • ts (array) – Time axis reference (seconds).

  • activity_index (array) – Activity index of the signal.

References

[Lin18]

W.-Y. Lin, V. Verma, M.-Y. Lee, C.-S. Lai, Activity

Monitoring with a Wrist-Worn, Accelerometer-Based Device, Micromachines 9 (2018) 450

biosppy.signals.acc.frequency_domain_feature_extractor(signal=None, sampling_rate=100.0)[source]

Extracts the FFT from each ACC sub-signal (x, y, z), given the signal itself.

Parameters:
  • signal (array) – Input ACC signal.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

Returns:

  • freq_features (dict) – Dictionary of positive frequencies (Hz) for all sub-signals.

  • amp_features (dict) – Dictionary of Normalized Absolute Amplitudes for all sub-signals.

biosppy.signals.acc.time_domain_feature_extractor(signal=None)[source]

Extracts the vector magnitude and signal magnitude features from an input ACC signal, given the signal itself.

Parameters:

signal (array) – Input ACC signal.

Returns:

  • vm_features (array) – Extracted Vector Magnitude (VM) feature.

  • sm_features (array) – Extracted Signal Magnitude (SM) feature.