Get sleep statistics

Get sleep statictics such as sleep stages duration, duration of the hypnogram.

from import download_file, get_sleep_stats

Hypnogram data

Download a hypnogram example

path_to_hypno = download_file("s101_jbe.hyp", astype='example_data')

Get sleep statistics

Sleep statistics are going to be printed in the terminal and then saved in a my_stats.csv

get_sleep_stats(path_to_hypno, output_file='my_stats.csv')


TIB      360.1666666666667
TDT      359.98333333333335
Art      39.5
W        19.166666666666668
N1       12.0
N2       115.5
N3       114.5
REM      59.5
LatN1    4.0
LatN2    7.0
LatN3    9.0
LatREM   66.0
SPT      355.98333333333335
WASO     15.0
TST      340.98333333333335
SE       94.72
Units    minutes
File     /home/circleci/visbrain_data/example_data/s101_jbe.hyp
CSV file saved to: my_stats.csv

Total running time of the script: ( 0 minutes 0.869 seconds)

Gallery generated by Sphinx-Gallery