sleep-utils


Namesleep-utils JSON
Version 1.17 PyPI version JSON
download
home_pagehttp://github.com/skjerns/sleep-utils
SummaryA collection of tools for sleep research
upload_time2024-06-24 14:43:40
maintainerNone
docs_urlNone
authorskjerns
requires_pythonNone
licenseGNU 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sleep-utils

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

<img src="./assets/d1f7592a94f0f39c4d672c5913e161ec16193458.png" title="" alt="sample_hypnogram.png" width="394">

<img src="./assets/c49446ae6d84dee6e13ae14034dd12eb6bbdb48d.png" title="" alt="spectrogram_multitaper.png" width="395">

<img src="md_assets/2022-07-25-13-06-18-image.png" title="" alt="" width="409">

```
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)`)


            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/skjerns/sleep-utils",
    "name": "sleep-utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "skjerns",
    "author_email": "nomail@nomail.com",
    "download_url": "https://files.pythonhosted.org/packages/8a/12/962fb05f0f053558ba03c5e5527843a7affc83baa5ebc75eed40e514f7e9/sleep-utils-1.17.tar.gz",
    "platform": null,
    "description": "# sleep-utils\n\nA python toolbox for sleep researchers. Plot hypnograms, spectrograms, confusion matrices, PSG summaries\n\n<img src=\"./assets/d1f7592a94f0f39c4d672c5913e161ec16193458.png\" title=\"\" alt=\"sample_hypnogram.png\" width=\"394\">\n\n<img src=\"./assets/c49446ae6d84dee6e13ae14034dd12eb6bbdb48d.png\" title=\"\" alt=\"spectrogram_multitaper.png\" width=\"395\">\n\n<img src=\"md_assets/2022-07-25-13-06-18-image.png\" title=\"\" alt=\"\" width=\"409\">\n\n```\nHypnogram summary\n{'TRT': 460.5,\n 'TST': 444.5,\n 'WASO': 16.0,\n 'lat_REM': 65.0,\n 'lat_S1': 0.0,\n 'lat_S2': 2.0,\n 'lat_S3': 9.0,\n 'min_REM': 109.5,\n 'min_S1': 13.5,\n 'min_S2': 214.0,\n 'min_S3': 107.5,\n 'perc_REM': 0.24634420697412823,\n 'perc_S1': 0.030371203599550055,\n 'perc_S2': 0.4814398200224972,\n 'perc_S3': 0.24184476940382452,\n 'perc_W': 0.03474484256243214,\n 'recording_length': 547.0,\n 'sleep_offset_after_rec_start': 534.0,\n 'sleep_onset_after_rec_start': 73.5}\n```\n\n#### Install\n\n```\npip install sleep-utils\n```\n\nor\n\n```\npip install git+https://github.com/skjerns/sleep-utils\n```\n\n#### Functionality\n\n`import sleep_utils`\n\n- hypnograms\n  \n  - load (`sleep_utils.read_hypno(file)`)\n  \n  - save(`sleep_utils.write_hypno(hypno, file)`\n  \n  - plot (`sleep_utils.plot_hypnogram(hypno)`)\n  \n  - convert (read&save)\n  \n  - print summary (TST, WASO, ...) (`sleep_utils.hypno_summary(hypno)`)\n\n- spectrograms\n  \n  - multitaper spectrogram (`sleep_utils.specgram_multitaper(data, sfreq)`)\n  \n  - welch spectrogram(`sleep_utils.specgram_welch(data, sfreq)`)\n\n- confusion matrix\n  \n  - plot inter rater confusion matrix (`sleep_utils.plot_confusion_matrix(confmat)`)\n\n- mne-edf\n  \n  - save MNE to edf (`sleep_utils.write_mne_edf(raw, filename)`)\n\n",
    "bugtrack_url": null,
    "license": "GNU 2.0",
    "summary": "A collection of tools for sleep research",
    "version": "1.17",
    "project_urls": {
        "Homepage": "http://github.com/skjerns/sleep-utils"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "503059f51fe6273a1d80dd3abec6d8a6a8e92573f7b56c7e2d39cb5db0be8ea2",
                "md5": "3f8878029a6e04fc5ff04e6b184dd05a",
                "sha256": "cdd15cdfb1802d3129f2b046e2857e6e1569003280fbe17fbe059db21ca91070"
            },
            "downloads": -1,
            "filename": "sleep_utils-1.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f8878029a6e04fc5ff04e6b184dd05a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 28361,
            "upload_time": "2024-06-24T14:43:39",
            "upload_time_iso_8601": "2024-06-24T14:43:39.687215Z",
            "url": "https://files.pythonhosted.org/packages/50/30/59f51fe6273a1d80dd3abec6d8a6a8e92573f7b56c7e2d39cb5db0be8ea2/sleep_utils-1.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a12962fb05f0f053558ba03c5e5527843a7affc83baa5ebc75eed40e514f7e9",
                "md5": "1aadcb5f96288332caffcc268da58d8a",
                "sha256": "33c50030e54b1bce455eb0e9d53b7fd1408faeebdd040d76e645ee86ee6cf87d"
            },
            "downloads": -1,
            "filename": "sleep-utils-1.17.tar.gz",
            "has_sig": false,
            "md5_digest": "1aadcb5f96288332caffcc268da58d8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 27492,
            "upload_time": "2024-06-24T14:43:40",
            "upload_time_iso_8601": "2024-06-24T14:43:40.731157Z",
            "url": "https://files.pythonhosted.org/packages/8a/12/962fb05f0f053558ba03c5e5527843a7affc83baa5ebc75eed40e514f7e9/sleep-utils-1.17.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-24 14:43:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "skjerns",
    "github_project": "sleep-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sleep-utils"
}
        
Elapsed time: 0.59908s