Skip to main content

A collection of tools for sleep research

Project description

sleep-utils

A python toolbox for sleep researchers. Plot hypnograms, spectrograms, confusion matrices, PSG summaries

sample_hypnogram.png spectrogram_multitaper.png
Hypnogram summary
{'TRT': 460.5,
 'TST': 444.5,
 'WASO': 16.0,
 'lat_REM': 65.0,
 'lat_S1': 0.0,
 'lat_S2': 2.0,
 'lat_S3': 9.0,
 'min_REM': 109.5,
 'min_S1': 13.5,
 'min_S2': 214.0,
 'min_S3': 107.5,
 'perc_REM': 0.24634420697412823,
 'perc_S1': 0.030371203599550055,
 'perc_S2': 0.4814398200224972,
 'perc_S3': 0.24184476940382452,
 'perc_W': 0.03474484256243214,
 'recording_length': 547.0,
 'sleep_offset_after_rec_start': 534.0,
 'sleep_onset_after_rec_start': 73.5}

Install

pip install sleep-utils

or

pip install git+https://github.com/skjerns/sleep-utils

Functionality

import sleep_utils

  • hypnograms

    • load (sleep_utils.read_hypno(file))

    • save(sleep_utils.write_hypno(hypno, file)

    • plot (sleep_utils.plot_hypnogram(hypno))

    • convert (read&save)

    • print summary (TST, WASO, ...) (sleep_utils.hypno_summary(hypno))

  • spectrograms

    • multitaper spectrogram (sleep_utils.specgram_multitaper(data, sfreq))

    • welch spectrogram(sleep_utils.specgram_welch(data, sfreq))

  • confusion matrix

    • plot inter rater confusion matrix (sleep_utils.plot_confusion_matrix(confmat))
  • mne-edf

    • save MNE to edf (sleep_utils.write_mne_edf(raw, filename))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleep-utils-1.17.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

sleep_utils-1.17-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file sleep-utils-1.17.tar.gz.

File metadata

  • Download URL: sleep-utils-1.17.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for sleep-utils-1.17.tar.gz
Algorithm Hash digest
SHA256 33c50030e54b1bce455eb0e9d53b7fd1408faeebdd040d76e645ee86ee6cf87d
MD5 1aadcb5f96288332caffcc268da58d8a
BLAKE2b-256 8a12962fb05f0f053558ba03c5e5527843a7affc83baa5ebc75eed40e514f7e9

See more details on using hashes here.

File details

Details for the file sleep_utils-1.17-py3-none-any.whl.

File metadata

  • Download URL: sleep_utils-1.17-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for sleep_utils-1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd15cdfb1802d3129f2b046e2857e6e1569003280fbe17fbe059db21ca91070
MD5 3f8878029a6e04fc5ff04e6b184dd05a
BLAKE2b-256 503059f51fe6273a1d80dd3abec6d8a6a8e92573f7b56c7e2d39cb5db0be8ea2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page