pyActigraphy.io.BaseRaw.fSoD

BaseRaw.fSoD(freq='5min', binarize=True, bin_threshold=4, whs=12, start='12:00:00', period='5h', algo='Roenneberg', *args, **kwargs)

Fraction of Sleep over Daytime

Fractional volume of epochs identified as sleep over daytime (SoD), using sleep-wake scoring algorithms.

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

  • binarize (bool, optional) – If set to True, the data are binarized when determining the activity onset and offset times. Only valid if start=’AonT’ or ‘AoffT’. Default is True.

  • bin_threshold (int, optional) – If binarize is set to True, data above this threshold are set to 1 and to 0 otherwise. Default is 4.

  • whs (int, optional) – Window half size. Default is 4

  • start (str, optional) – Start time of the period of interest. Supported times: ‘AonT’, ‘AoffT’, any ‘HH:MM:SS’. Default: ‘12:00:00’.

  • period (str, optional) – Period length. Default is ‘10h’.

  • 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

  • fsod (float) – Fraction of epochs scored as sleep, relatively to the length of the specified period.

  • .. warning:: The value of this variable depends on the convention used – by the underlying sleep scoring algorithm. The expected convention is the following:

    • epochs scored as 1 refer to inactivity/sleep

    Otherwise, this variable will actually return the fraction of epochs scored as activity. The fraction of sleep can simply be recovered by calculating (1-fSOD).

Examples

>>> import pyActigraphy
>>> rawAWD = pyActigraphy.io.read_raw_awd(fpath + 'SUBJECT_01.AWD')
>>> raw.fSoD()
0.17763779527559054
>>> raw.fSoD(algo='ck')
0.23811023622047245