biopsykit.sleep.sleep_processing_pipeline package

Functions to process sleep data from raw IMU data or Actigraph data.

biopsykit.sleep.sleep_processing_pipeline.predict_pipeline_acceleration(data, sampling_rate, convert_to_g=True, **kwargs)[source]

Apply sleep processing pipeline on raw acceleration data.

This function processes raw acceleration data collected during sleep. The pipeline consists of the following steps:

  • Activity Count Conversion: Convert (3-axis) raw acceleration data into activity counts. Most sleep/wake detection algorithms use activity counts (as typically provided by Actigraph devices) as input data.

  • Wear Detection: Detect wear and non-wear periods. Cut data to the longest continuous wear block.

  • Rest Periods: Detect rest periods, i.e., periods with large physical inactivity. The longest continuous rest period (Major Rest Period) is used to determine the Bed Interval, i.e., the period spent in bed.

  • Sleep/Wake Detection: Apply sleep/wake detection algorithm to classify phases of sleep and wake.

  • Sleep Endpoint Computation: Compute Sleep Endpoints from sleep/wake detection results and bed interval.

Parameters
  • data (array_like with shape (n,3)) – input data. Must be a 3-d acceleration signal

  • sampling_rate (float) – sampling rate of recorded data in Hz

  • convert_to_g (bool, optional) – True if input data is provided in \(m/s^2\) and should be converted in \(g\), False if input data is already in \(g\) and does not need to be converted. Default: True

  • **kwargs

    additional parameters to configure sleep/wake detection. The possible parameters depend on the selected sleep/wake detection algorithm and are passed to SleepWakeDetection. Examples are:

    • algorithm_type: name of sleep/wake detection algorithm to internally use for sleep/wake detection. Default: “Cole/Kripke”

    • epoch_length: epoch length in seconds. Default: 60

Returns

dictionary with Sleep Processing Pipeline results.

Return type

dict

biopsykit.sleep.sleep_processing_pipeline.predict_pipeline_actigraph(data, algorithm_type, bed_interval, **kwargs)[source]

Apply sleep processing pipeline on actigraph data.

This function processes actigraph data collected during sleep and performs sleep/wake detection.

Parameters
  • data (array_like with shape (n,3)) – input data. Must be a 3-d acceleration signal

  • algorithm_type (str) – name of sleep/wake detection algorithm to internally use for sleep/wake detection

  • bed_interval (array_like) – beginning and end of bed interval, i.e., the time spent in bed

  • **kwargs – additional parameters to configure sleep/wake detection. The possible parameters depend on the selected sleep/wake detection algorithm and are passed to SleepWakeDetection.

Returns

dictionary with Sleep Processing Pipeline results.

Return type

dict