pyActigraphy.io.BaseRaw.Oakley¶
- BaseRaw.Oakley(threshold=40)¶
Oakley’s algorithm for sleep/wake scoring.
Algorithm for automatic sleep/wake scoring based on wrist activity, developed by Oakley [1].
- Parameters
threshold (float or str, optional) – Threshold value for scoring sleep/wake. Can be set to “automatic” (cf. Notes). Default is 40.
- Returns
oakley – Time series containing scores (1: sleep, 0: wake) for each epoch.
- Return type
pandas.core.Series
Notes
The output variable O of Oakley’s algorithm is defined as:
\[O = ( [W_{-2},W_{-1},W_{0},W_{+1},W_{+2}] \cdot [A_{-2},A_{-1},A_{0},A_{+1},A_{+2}])\]with:
O <= threshold == sleep, 0 > threshold == wake;
\(W_{0},W_{-1},W_{+1},\dots\), weighting factors for the present epoch, the previous epoch, the following epoch, etc.;
\(A_{0},A_{-1},A_{+1},\dots\), activity scores for the present epoch, the previous epoch, the following epoch, etc.
The current implementation of this algorithm follows the description provided in the instruction manual of the Actiwatch Communication and Sleep Analysis Software (Respironics, Inc.) [2] :
- 15-second sampling frequency:
- \[\begin{split}W_{-8} &= \ldots = W_{-5} = W_{+5} = \ldots = W_{+8} = 1/25 \\ W_{-4} &= \ldots = W_{-1} = W_{+1} = \ldots = W_{+4} = 1/5 \\ W_{0} &= 4\end{split}\]
- 30-second sampling frequency:
- \[\begin{split}W_{-4} &= W_{-3} = W_{+3} = W_{+4} = 1/25 \\ W_{-2} &= W_{-1} = W_{+1} = W_{+2} = 1/5 \\ W_{0} &= 2\end{split}\]
- 60-second sampling frequency:
- \[\begin{split}W_{-2} &= W_{+2} = 1/25 \\ W_{-1} &= W_{+1} = 1/5 \\ W_{0} &= 1\end{split}\]
- 120-second sampling frequency:
- \[\begin{split}W_{-1} &= W_{+1} = 1/8 \\ W_{0} &= 1/2\end{split}\]
The Automatic Wake Threshold Value calculation is this [2]:
Sum the activity counts for all epochs of the data set.
Count the number of epochs scored as MOBILE for the data set (the definition of MOBILE follows).
Compute the MOBILE TIME (number of epochs scored as MOBILE from step 2 multiplied by the Epoch Length) in minutes.
Compute the Auto Wake Threshold = ((sum of activity counts from step 1) divided by (MOBILE TIME from step 3)) multiplied by 0.88888.
Definition of Mobile [2]:
An epoch is scored as MOBILE if the number of activity counts recorded in that epoch is greater than or equal to the epoch length in 15-second intervals. For example,there are four 15-second intervals for a 1-minute epoch length; hence, the activity value in an epoch must be greater than, or equal to, four, to be scored as MOBILE.
References
- 1
Oakley, N.R. Validation with Polysomnography of the Sleepwatch Sleep/Wake Scoring Algorithm Used by the Actiwatch Activity Monitoring System; Technical Report; Mini-Mitter: Bend, OR, USA, 1997
- 2(1,2,3)
Instruction manual, Actiwatch Communication and Sleep Analysis Software (https://fccid.io/JIAAWR1/Users-Manual/USERS-MANUAL-1-920937)