# MiSleep
MiSleep is for EEG/EMG signal processing and visualization
![logo](resources/entire_logo.png)
## Get start
```shell
pip install misleep==0.1.1
```
Find the directory where you installed misleep, run
```shell
python -m misleep
```
### New features
1. New data structure
You can save the original data as a new data structure (See `Data save protocol`).
Where you can add the channels' name, sampling rate and the acquisition time into
the original data.
2. Annotate more details
Here we provide the start_end mode as a more precise way to annotate the event such
as Slow Wave Activities or Spindle, e.t. You can select the `Start-End` mode in
the Annotation tool dock and click wherever in the signal area to annotate the
event.
2. Tool bar dock
![dock](resources/dockoperation.gif)
Now you can move the toolbar to wherever you want.
3. Color for state
![statecolor](resources/statecolor.gif)
Different color background for different sleep states. Now the color map is:
Init: White; NREM: Orange; REM: Blue; Wake: Red.
**Future**: you can self-define the color for each sleep state.
## Data save protocol
You need to use matlab for data saving, the final data should be a structure.
If you are using TDT for recording, here is the example script to save the data.
```matlab
tdt_data = ...
data.EEG_F = tdt_data.streams.EEG1.data(1, :);
data.EEG_P = tdt_data.streams.EEG1.data(2, :);
data.EEG_DIFF = data.EEG_F - data.EEG_P
data.EMG_1 = tdt_data.streams.EMG1.data(1, :);
data.EMG_2 = tdt_data.streams.EMG1.data(2, :);
data.EMG_DIFF = data.EMG_1 - data.EMG_2;
data.REF = data.streams.mou1.data(1, :);
data.channels = {'EEG_F' 'EEG_P' 'EEG_DIFF' 'EMG_1' 'EMG_2' 'EMG_DIFF' 'REF'}
data.sf = {305.1758 305.1758 305.1758 305.1758 305.1758 305.1758 305.1758}
data.time = {'20240409-18:00:00'}
```
And an example of result data:
![Alt text](resources/matdata.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/BryanWang0702/MiSleep/",
"name": "misleep",
"maintainer": "Xueqiang Wang",
"docs_url": null,
"requires_python": null,
"maintainer_email": "swang@gmail.com",
"keywords": null,
"author": "Xueqiang Wang",
"author_email": "swang@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/99/6d/b043f752382127a41b18f1266486bb2ac35a01def261c9428e7b1a3098cb/misleep-0.1.6.tar.gz",
"platform": null,
"description": "# MiSleep\r\nMiSleep is for EEG/EMG signal processing and visualization\r\n\r\n![logo](resources/entire_logo.png)\r\n\r\n## Get start\r\n```shell\r\npip install misleep==0.1.1\r\n```\r\n\r\nFind the directory where you installed misleep, run\r\n```shell\r\npython -m misleep\r\n```\r\n\r\n### New features\r\n1. New data structure\r\n\r\nYou can save the original data as a new data structure (See `Data save protocol`).\r\nWhere you can add the channels' name, sampling rate and the acquisition time into \r\nthe original data.\r\n\r\n2. Annotate more details\r\n\r\nHere we provide the start_end mode as a more precise way to annotate the event such\r\nas Slow Wave Activities or Spindle, e.t. You can select the `Start-End` mode in\r\nthe Annotation tool dock and click wherever in the signal area to annotate the \r\nevent.\r\n\r\n2. Tool bar dock\r\n\r\n![dock](resources/dockoperation.gif)\r\n\r\nNow you can move the toolbar to wherever you want.\r\n\r\n3. Color for state\r\n\r\n![statecolor](resources/statecolor.gif)\r\n\r\nDifferent color background for different sleep states. Now the color map is:\r\n\r\nInit: White; NREM: Orange; REM: Blue; Wake: Red.\r\n\r\n**Future**: you can self-define the color for each sleep state.\r\n\r\n\r\n\r\n## Data save protocol\r\nYou need to use matlab for data saving, the final data should be a structure.\r\n\r\n\r\nIf you are using TDT for recording, here is the example script to save the data.\r\n```matlab\r\ntdt_data = ...\r\n\r\ndata.EEG_F = tdt_data.streams.EEG1.data(1, :);\r\ndata.EEG_P = tdt_data.streams.EEG1.data(2, :);\r\ndata.EEG_DIFF = data.EEG_F - data.EEG_P\r\ndata.EMG_1 = tdt_data.streams.EMG1.data(1, :);\r\ndata.EMG_2 = tdt_data.streams.EMG1.data(2, :);\r\ndata.EMG_DIFF = data.EMG_1 - data.EMG_2;\r\ndata.REF = data.streams.mou1.data(1, :);\r\ndata.channels = {'EEG_F' 'EEG_P' 'EEG_DIFF' 'EMG_1' 'EMG_2' 'EMG_DIFF' 'REF'}\r\ndata.sf = {305.1758 305.1758 305.1758 305.1758 305.1758 305.1758 305.1758}\r\ndata.time = {'20240409-18:00:00'}\r\n```\r\nAnd an example of result data:\r\n\r\n![Alt text](resources/matdata.png)\r\n",
"bugtrack_url": null,
"license": "BSD (3-clause)",
"summary": "MiSleep: Mice Sleep EEG/EMG visualization, scoring and analysis.",
"version": "0.1.6",
"project_urls": {
"Download": "https://github.com/BryanWang0702/MiSleep/",
"Homepage": "https://github.com/BryanWang0702/MiSleep/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f5503f6ba45456a03aca123326aeae0f79680fb41f17e18f03356ba59586babf",
"md5": "edf783028a11835918137553d15f27f3",
"sha256": "6db0860a2abe5ad3a1d4e77704636c6f83d6001d07472e162ce764e1eed3db06"
},
"downloads": -1,
"filename": "misleep-0.1.6-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "edf783028a11835918137553d15f27f3",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 99591,
"upload_time": "2024-05-15T03:18:40",
"upload_time_iso_8601": "2024-05-15T03:18:40.551297Z",
"url": "https://files.pythonhosted.org/packages/f5/50/3f6ba45456a03aca123326aeae0f79680fb41f17e18f03356ba59586babf/misleep-0.1.6-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "996db043f752382127a41b18f1266486bb2ac35a01def261c9428e7b1a3098cb",
"md5": "8f470c00ee74989406edc5b2a3759d38",
"sha256": "7f6d9f7c6ea7a7de0729461b4f313a63024834932f7c13d961c4aa2d970867db"
},
"downloads": -1,
"filename": "misleep-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "8f470c00ee74989406edc5b2a3759d38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 78850,
"upload_time": "2024-05-15T03:18:42",
"upload_time_iso_8601": "2024-05-15T03:18:42.169652Z",
"url": "https://files.pythonhosted.org/packages/99/6d/b043f752382127a41b18f1266486bb2ac35a01def261c9428e7b1a3098cb/misleep-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-15 03:18:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BryanWang0702",
"github_project": "MiSleep",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "misleep"
}