pyActigraphy.sleep.ScoringMixin.Crespo

ScoringMixin.Crespo(zeta=15, zeta_r=30, zeta_a=2, t=0.33, alpha='8h', beta='1h', estimate_zeta=False, seq_length_max=100, verbose=False)[source]

Crespo algorithm for activity/rest identification

Algorithm for automatic identification of activity-rest periods based on actigraphy, developped by Crespo et al. [1].

Parameters
  • zeta (int, optional) – Maximum number of consecutive zeroes considered valid. Default is 15.

  • zeta_r (int, optional) – Maximum number of consecutive zeroes considered valid (rest). Default is 30.

  • zeta_a (int, optional) – Maximum number of consecutive zeroes considered valid (active). Default is 2.

  • t (float, optional) – Percentile for invalid zeroes. Default is 0.33.

  • alpha (str, optional) – Average hours of sleep per night. Default is ‘8h’.

  • beta (str, optional) – Length of the padding sequence used during the processing. Default is ‘1h’.

  • estimate_zeta (bool, optional) – If set to True, zeta values are estimated from the distribution of ratios of the number of series of consecutive zeroes to the number of series randomly chosen from the actigraphy data. Default is False.

  • seq_length_max (int, optional) – Maximal length of the aforementioned random series. Default is 100.

  • verbose (bool, optional) – If set to True, print the estimated values of zeta. Default is False.

Returns

crespo – Time series containing the estimated periods of rest (0) and activity (1).

Return type

pandas.core.Series

References

1

Crespo, C., Aboy, M., Fernández, J. R., & Mojón, A. (2012). Automatic identification of activity–rest periods based on actigraphy. Medical & Biological Engineering & Computing, 50(4), 329–340. http://doi.org/10.1007/s11517-012-0875-y

Examples

>>> import pyActigraphy
>>> rawAWD = pyActigraphy.io.read_raw_awd(fpath + 'SUBJECT_01.AWD')
>>> crespo = rawAWD.Crespo()
>>> crespo
2018-03-26 14:16:00    1
2018-03-26 14:17:00    0
2018-03-26 14:18:00    0
(...)
2018-04-06 08:22:00    0
2018-04-06 08:23:00    0
2018-04-06 08:24:00    1
Length: 15489, dtype: int64