pyActigraphy.sleep.ScoringMixin.SleepMidPoint

ScoringMixin.SleepMidPoint(freq='15min', bin_threshold=None, to_td=True, algo='Roenneberg', *args, **kwargs)[source]

Sleep midpoint

Center of the mean sleep periods

Parameters
  • freq (str, optional) – Resampling frequency. Default is ‘15min’

  • bin_threshold (bool, optional) – If bin_threshold is not set to None, scoring data above this threshold are set to 1 and to 0 otherwise. Default is None.

  • to_td (bool, optional) – If set to true, the sleep midpoint is returned as a Timedelta. Otherwise, it represents the number of minutes since midnight.

  • algo (str, optional) – Sleep scoring algorithm to use. Default is ‘Roenneberg’.

  • *args – Variable length argument list passed to the scoring algorithm.

  • **kwargs – Arbitrary keyword arguements passed to the scoring algorithm.

Returns

smp

Return type

float or Timedelta

Notes

Sleep midpoint (SMP) is an index of sleep timing and is calculated as the following [1]:

\[SMP = \frac{1440}{2\pi} arctan2\left( \sum_{j=1}^M\sum_{i=1}^N s_{i,j} \times sin\left(\frac{2\pi t_i}{1440}\right), \sum_{j=1}^M\sum_{i=1}^N s_{i,j} \times cos\left(\frac{2\pi t_i}{1440}\right) \right)\]
with:
  • \(t_j\), time of day in minutes at epoch j,

  • \(\delta(s_{i,j}, s_{i+1,j}) = 1\) if \(s_{i,j} = s_{i+1,j}\) and 0 otherwise.

References

1

Lunsford-Avery, J. R., Engelhard, M. M., Navar, A. M., & Kollins, S. H. (2018). Validation of the Sleep Regularity Index in Older Adults and Associations with Cardiometabolic Risk. Scientific Reports, 8(1), 14158. https://doi.org/10.1038/s41598-018-32402-5

Examples