sit2standpy.v2.Detector

class sit2standpy.v2.detectors.Detector(stillness_constraint=True, gravity=9.81, thresholds=None, gravity_pass_order=4, gravity_pass_cutoff=0.8, long_still=0.5, moving_window=0.3, duration_factor=10, displacement_factor=0.75, **kwargs)

Method for detecting sit-to-stand transitions based on a series of heuristic signal processing rules.

Parameters:
stillness_constraint : bool, optional

Whether or not to impose the stillness constraint on the detected transitions. Default is True.

gravity : float, optional

Value of gravitational acceleration measured by the accelerometer when still. Default is 9.81 m/s^2.

thresholds : dict, optional

A dictionary of thresholds to change for stillness detection and transition verification. See Notes for default values. Only values present will be used over the defaults.

gravity_pass_order : int, optional

Low-pass filter order for estimating the direction of gravity by low-pass filtering the raw acceleration. Default is 4.

gravity_pass_cutoff : float, optional

Low-pass filter frequency cutoff for estimating the direction of gravity. Default is 0.8Hz.

long_still : float, optional

Length of time of stillness for it to be considered a long period of stillness. Used to determine the integration window limits when available. Default is 0.5s

moving_window : float, optional

Length of the moving window for calculating the moving statistics for determining stillness. Default is 0.3s.

duration_factor : float, optional

The factor for the maximum different between the duration before and after the generalized location of the sit to stand as located by the power_peaks in the AccelerationFilter. Lower factors results in more equal time before and after the detected time point. Default is 10, which effectively removes this constraint.

displacement_factor : float, optional

Factor multiplied by the median of the vertical displacements for all transitions to determine the threshold for checking if a transition is a partial or full transition. Default is 0.75

Notes

stillness_constraint determines whether or not a sit-to-stand transition is required to start and the end of a still period in the data. This constraint is suggested for at-home data. For processing clinic data, it is suggested to set this to False, especially if processing a task where sit-to-stands are repeated in rapid succession.

Default thresholds:
  • stand displacement: 0.125
  • transition velocity: 0.2
  • accel moving avg: 0.2
  • accel moving std: 0.1
  • jerk moving avg: 2.5
  • jerk moving std: 3
Attributes:
data

Methods

predict(data) Fit and transform the data with the given process.
sparc(x, fs[, padlevel, fc, amp_th]) SPectral ARC length metric for quantifying smoothness
static sparc(x, fs, padlevel=4, fc=10.0, amp_th=0.05)

SPectral ARC length metric for quantifying smoothness

Parameters:
x : numpy.ndarray

Array containing the data to be analyzed for smoothness

fs : float

Sampling frequency

padlevel : int, optional

Indicates the amount of zero-padding to be done to the movement data for estimating the spectral arc length. Default is 4.

fc : float, optional

The max cutoff frequency for calculating the spectral arc length metric. Default is 10.0

amp_th : float, optional

The amplitude threshold to be used for determining the cut off frequency up to which the spectral arc length is to be estimated. Default is 0.05

Returns:
sal : float

The spectral arc length estimate of the given data’s smoothness

(f, Mf) : (numpy.ndarray, numpy.ndarray)

The frequency and the magnitude spectrum of the input data. This spectral is from 0 to the Nyquist frequency

(f_sel, Mf_sel) : (numpy.ndarray, numpy.ndarray)

The portion of the spectrum that is selected for calculating the spectral arc length

References

S. Balasubramanian, A. Melendez-Calderon, A. Roby-Brami, E. Burdet. “On the analysis of movement smoothness.” Journal of NeuroEngineering and Rehabilitation. 2015.