Accelerometer Data

Introduction

Blah.

API

hsltools.Shimmer.approx_entropy(signal)

Returns the approximate entropy of the signal.

Approximate entropy (ApEn) is a method for determining system complexity of biological signals [7]. ApEn is based on the sequence recurrence of the data. ApEn quantifies the unpredictability of fluctuations in a time-domain dataset. The minimum value for ApEn is 0, indicating a completely predictable dataset [8]. The algorithm for ApEn [9] relies on two parameters: m (see max_dists) and r, a positive real number that indicates a “scaling range,” or level of filtering. In this case, m = 2 and r = 0.25 [2].

[2] Lee, C.-H.; Sun, T.-L.; Jiang, B.C.; Choi, V.H. Using Wearable Accelerometers in a Community Service Context to Categorize Falling Behavior. Entropy 2016, 18, 257. [7] Pincus, S. Approximate entropy (apen) as a complexity measure. Chaos: An Interdisciplinary Journal of Nonlinear Science 5, 110–117 (1995). [8] G. M. Lee, S. Fattinger, A. L. Mouthon, Q. Noirhomme, and R. Huber, “Electroencephalogram approximate entropy influenced by both age and sleep,” Front. Neuroinf. 7, 33 (2013). https://doi.org/10.3389/fninf.2013.00033 [9] Pincus SM. Approximate entropy as a measure of system complexity. Proc Natl Acad Sci U S A. 1991;88(6):2297–2301. doi:10.1073/pnas.88.6.2297

Parameters

signal (array-like) – Array containing numbers whose approximate entropy is desired.

Returns

Returns the approximate entropy of the signal.

Return type

float

hsltools.Shimmer.flux_stats(signal)

Returns statistics extracted from the spectral flux (see spectral_flux) of the signal (maximum, minimum, integral, max inflection point, min inflection point, slope, intercept, r value)

Parameters

signal (array-like) – Array containing numbers whose spectral flux statistics are desired.

Returns

Returns array of spectral flux statistics including the linear regression [maximum, minimum, integral, inflection_pt_max, inflection_pt_min, slope, intercept, rval]

Return type

array-like

maximum - maximum of the spectral_flux means minimum - minimum of the spectral_flux means integral - integral of the spectral_flux means using the trapezoidal integration method inflection_pt_max - maximum inflection point after a smoothing Savitzky-Golay filter was applied inflection_pt_min - minimum inflection point after a smoothing Savitzky-Golay filter was applied slope - slope of spectral_flux means after a smoothing Savitzky-Golay filter was applied intercept - intercept of spectral_flux means after a smoothing Savitzky-Golay filter was applied rval - r value of spectral_flux means after a smoothing Savitzky-Golay filter was applied

hsltools.Shimmer.fractal_dim(signal)

Returns features of the signal using wavelet-based fractal estimation (spectral index, Hurst exponent, fractal dimension, wavelet function integrals, fourier transform integrals)

Discrete Wavelet Transform (DWT) takes into account both the time domain and frequency domain of a signal [1]. DWT can analyze specific EEG, ECG, and EMG signals as well as general movement from accelerometer data [2]. The integrals of the wavelet function and its fourier transform can also be used to measure approximations of the energy in the signal [4].

[1] Dora M. Ballesteros, Andres E. Gaona2 and Luis F. Pedraza, “Discrete Wavelet Transform in Compression and Filtering of Biomedical Signals”, ISBN: 978-953-307-654-6. [2] Discrimination of Walking Patterns Using Wavelet-Based Fractal Analysis Masaki Sekine, Associate Member, IEEE, Toshiyo Tamura, Member, IEEE, Metin Akay, Senior Member, IEEE, Toshiro Fujimoto, Tatsuo Togawa, Senior Member, IEEE, and Yasuhiro Fukui, Member, IEEE [4] Błażejewski, A., Głowiński, S., & Maciejewski, I. (2019). The wavelet transfer function of a human body–seat system. Journal of Low Frequency Noise, Vibration and Active Control, 38(2), 817–825. https://doi.org/10.1177/1461348417747180

Parameters

signal (array-like) – Array containing numbers whose fractal dimension is desired.

Returns

Returns an array of fractal dimension statistics [beta, H, fractal_dim, d1_time_int, d10_time_int, diff_time, d1_fft_int, d10_fft_int, diff_fft].

A DWT decomposes a signal into a detailed signal, d_2j, and an approximate signal, a_2j. The parameter j controls the dilation and compression of the scaling functions: j=0 results in an approximate signal roughly equal to the original signal, and the function loses resolution as j increases [2].

beta - spectral index, calculated from relation that the variance of d_2j is inversely proportional to (2^j)^β H - Hurst exponent, a measure of self-similarity decay in a time series [3] approximated from beta fractal_dim - fractal dimension, a measure of complexity and smoothness related to H by the equation [2] D = 2-H d1_time_int - integral of the wavelet function when j = 1 d10_time_int - integral of the wavelet function when j = 10 diff_time - difference between d1_time_int and d10_time_int d1_fft_int - integral of the wavelet function’s fourier transform when j = 1 d10_fft_int - integral of the wavelet function’s fourier transform when j = 10 diff_fft - difference between d1_fft_int and d10_fft_int

[2] Discrimination of Walking Patterns Using Wavelet-Based Fractal Analysis Masaki Sekine, Associate Member, IEEE, Toshiyo Tamura, Member, IEEE, Metin Akay, Senior Member, IEEE, Toshiro Fujimoto, Tatsuo Togawa, Senior Member, IEEE, and Yasuhiro Fukui, Member, IEEE [3] Cannon MJ, Percival DB, Caccia DC, Raymond GM, Bassingthwaighte JB. Evaluating scaled windowed variance methods for estimating the Hurst coefficient of time series. Physica A. 1997;241(3-4):606‐626. doi:10.1016/S0378-4371(97)00252-5

Return type

array-like

hsltools.Shimmer.max_dists(signal, m)

Returns the maximum Chebyshev distances of the signal.

Parameters
  • signal (array-like) – Array containing numbers whose maximum distances are desired.

  • m (int) – A positive integer that indicates the length of each vector.

Returns

Returns the maximum Chebyshev distances, type double, of the signal.

Return type

array-like

hsltools.Shimmer.multiscale_entropy(signal)

Returns the mean multiscale entropy of the signal.

Multiscale entropy (MSE) uses the same algorithm as sample entropy (see sample_entropy) [12], and has been used to measure human postural signals [13], but further breaks down the data by introducing another parameter. MSE collects every nth data point and then collects the SampEn from that smaller dataset. This procedure is repeated for several values of n, ranging from 2 to 20. From this series of sample entropies, the mean, standard deviation, and integral are collected. MSE allows for the assessment of variability and fluctuations over a range of time scales, meaning that the temporal dynamics of several different network structures can be measured [14].

[12] Delgado-Bonal A, Marshak A. Approximate Entropy and Sample Entropy: A Comprehensive Tutorial. Entropy. 2019; 21(6):541. [13] S. Lu, J. Shieh and C. Hansen, “Applied a Multi-scale Entropy Algorithm to Analyze Dynamic COP Signal via Accelerometer Sensor,” 2016 Intl IEEE Conferences on Ubiquitous Intelligence & Computing, Advanced and Trusted Computing, Scalable Computing and Communications, Cloud and Big Data Computing, Internet of People, and Smart World Congress (UIC/ATC/ScalCom/CBDCom/IoP/SmartWorld), Toulouse, 2016, pp. 127-132. [14] Gao J, Hu J, Liu F and Cao Y (2015) Multiscale entropy analysis of biological signals: a fundamental bi-scaling law. Front. Comput. Neurosci. 9:64. doi: 10.3389/fncom.2015.00064

Parameters

signal (array-like) – Array containing numbers whose mean multiscale entropy is desired.

Returns

Returns the mean multiscale entropy of the signal.

Return type

ndarray

hsltools.Shimmer.sample_entropy(signal)

Returns the sample entropy of the signal.

Sample entropy (SampEn) is an entropy measure that quantifies regularity and complexity. SampEn is the negative natural logarithm of the probability that two uniform, random vectors of m+1 consecutive data points have distance r given that the corresponding vectors of length m have a distance less than or equal to r [11]. SampEn has been used with center of pressure (COP) time series [10], heart rate, and other biological data series. SampEn addresses the bias of approximate entropy, which increases asymptotically as N (the number of data points) increases [12]. SampEn can measure postural control in the assessment of sensory integration and vestibular function [11]. The algorithm relies on parameters m and r (see approx_entropy), in this case, m = 4 and r = 0.3 [10].

[10] Montesinos, L., Castaldo, R. & Pecchia, L. On the use of approximate entropy and sample entropy with centre of pressure time-series. J NeuroEngineering Rehabil 15, 116 (2018). https://doi.org/10.1186/s12984-018-0465-9 [11] Lubetzky AV, Harel D, Lubetzky E (2018) On the effects of signal processing on sample entropy for postural control. PLoS ONE 13(3): e0193460. https://doi.org/10.1371/journal.pone.0193460 [12] Delgado-Bonal A, Marshak A. Approximate Entropy and Sample Entropy: A Comprehensive Tutorial. Entropy. 2019; 21(6):541.

Parameters

signal (array-like) – Array containing numbers whose sample entropy is desired.

Returns

Returns the sample entropy of the signal.

Return type

float

hsltools.Shimmer.shimmer_all_features(signal)

Returns all of the Shimmer features of the signal in the form of a labeled data frame (basics.signal_statistics, spectrum_statistics, flux_stats, approx_entropy, sample_entropy, multiscale_entropy, fractal_dim).

Parameters

signal (array-like) – Array containing numbers whose Shimmer features are desired.

Returns

Returns a data frame of all the Shimmer features with the column headings [shim_mean, shim_std, shim_skewness, shim_kurtosis, shim_maximum, shim_minimum, shim_iqr, shim_variation, shim_entropy, shim_corrtime, shim_peakfreq, shim_peakpower, shim_powerint, shim_specenergy, shim_shannon, shim_spectral_centroid, flux_maximum, flux_minimum, flux_integral, flux_inflection_pt_max, flux_inflection_pt_min, flux_slope, flux_intercept, flux_rval, approx_entropy, sample_entropy, multiscale_entropy, beta, H, fractal_dim, d1_time_int, d10_time_int, diff_time, d1_fft_int, d10_fft_int, diff_fft]

shim_mean, shim_std, …, shim_corrtime - see signal_statistics shim_peakfreq, shim_peakpower, …, shim_spectral_centroid - see spectrum_statistics flux_maximum, flux_minimum, …, flux_rval - see flux_stats approx_entropy - see approx_entropy sample_entropy - see sample_entropy multiscale_entropy - see multiscale_entropy beta, H, … diff_fft - see fractal_dim

Return type

DataFrame

hsltools.Shimmer.spectral_flux(signal, nsplits)

Returns the means and standard deviations of the spectral flux for the signal.

Spectral flux is a “low-uncertainty” feature, meaning that it is not highly impacted by suboptimal calibration or placement of the sensing device [1]. It measures how quickly the power spectral changes between two adjacent windows, and was calculated using the squared difference between the normalized magnitudes of these spectra within the windows [2].

[1] Dargie, Waltenegus. (2009). Analysis of Time and Frequency Domain Features of Accelerometer Measurements. Proceedings - International Conference on Computer Communications and Networks, ICCCN. 1 - 6. 10.1109/ICCCN.2009.5235366. [2] B. Boashash, “Detection classification and estimation in the (t-f) domain” in Time-Frequency Signal Analysis and Processing: A Comprehensive Reference, London, U.K.:Elsevier, pp. 693-743, 2016.

Parameters
  • signal (array-like) – Array containing numbers whose spectral flux means and standard deviations are desired.

  • nsplits (int) – Number of splits of the signal.

Returns

Returns array of spectral flux features [means, stds]

means - mean of the spectral flux values for each signal with window sizes ranging from 2 to 500 stds - standard deviation of the spectral flux values for each signal with window sizes ranging from 2 to 500

Return type

array-like

hsltools.Shimmer.spectrum_statistics(signal)

Returns an array containing basic statistics of the signal (peak, peak magnitude, integral, energy, shannon, spectral centroid).

Parameters

signal (array-like) – Array containing numbers whose spectrum statistics are desired.

Returns

Returns array of spectrum statistics [peak, peakmag, integral, energy, shannon, spectral_centroid].

peak - peak frequency of the signal peakmag - peak power of the signal integral - integral of signal using the composite trapezoidal rule energy - spectral energy of the signal shannon - The Shannon entropy, or self-information is a quantity that identifies the amount of information associated with an event using the probabilities of the event. There is an inverse relationship between probability and information, as low-probability events carry more information [3],[4]. spectral_centroid - spectral centroid of the signal

[3] https://arxiv.org/pdf/1405.2061.pdf [4] https://towardsdatascience.com/the-intuition-behind-shannons-entropy-e74820fe9800

Return type

array-like