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.26.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sleep_utils-1.26-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file sleep_utils-1.26.tar.gz.

File metadata

  • Download URL: sleep_utils-1.26.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sleep_utils-1.26.tar.gz
Algorithm Hash digest
SHA256 46d8f58bdcc0c4bb066bb726b478fbb84c5aff8d37cdcfa06d4c6d1c5e1b08d9
MD5 1b3330f546d7b4899c42810aafc0411d
BLAKE2b-256 8578f8637122bd4abda545943caf05d6fc7c7bd150acb48ead318e6534380a89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sleep_utils-1.26-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sleep_utils-1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 992449ca77df56f1aa1871b7ce0236d135e1774f7c10678fd2c7a41f0fdf150e
MD5 befceb939b2907795713fbbbbe8af129
BLAKE2b-256 35ed068edfd3a81c492837c0a0da0886f25b4fbb4164748ab824080fe8d06607

See more details on using hashes here.

Supported by

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