misleep 0.1.0b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. misleep-0.1.0b0/LICENSE +29 -0
  2. misleep-0.1.0b0/PKG-INFO +35 -0
  3. misleep-0.1.0b0/README.md +7 -0
  4. misleep-0.1.0b0/misleep/__init__.py +10 -0
  5. misleep-0.1.0b0/misleep/__main__.py +10 -0
  6. misleep-0.1.0b0/misleep/config.ini +11 -0
  7. misleep-0.1.0b0/misleep/gui/__init__.py +17 -0
  8. misleep-0.1.0b0/misleep/gui/about.py +30 -0
  9. misleep-0.1.0b0/misleep/gui/label_dialog.py +144 -0
  10. misleep-0.1.0b0/misleep/gui/main_window.py +1261 -0
  11. misleep-0.1.0b0/misleep/gui/resources/__init__.py +2 -0
  12. misleep-0.1.0b0/misleep/gui/resources/entire_logo.png +0 -0
  13. misleep-0.1.0b0/misleep/gui/resources/logo.png +0 -0
  14. misleep-0.1.0b0/misleep/gui/resources/misleep.py +847 -0
  15. misleep-0.1.0b0/misleep/gui/resources/misleep.qrc +6 -0
  16. misleep-0.1.0b0/misleep/gui/show.py +25 -0
  17. misleep-0.1.0b0/misleep/gui/spec_window.py +113 -0
  18. misleep-0.1.0b0/misleep/gui/thread.py +71 -0
  19. misleep-0.1.0b0/misleep/gui/uis/__init__.py +12 -0
  20. misleep-0.1.0b0/misleep/gui/uis/about_ui.py +59 -0
  21. misleep-0.1.0b0/misleep/gui/uis/label_dialog_ui.py +50 -0
  22. misleep-0.1.0b0/misleep/gui/uis/main_window_ui.py +397 -0
  23. misleep-0.1.0b0/misleep/gui/uis/spec_window_ui.py +77 -0
  24. misleep-0.1.0b0/misleep/gui/utils.py +24 -0
  25. misleep-0.1.0b0/misleep/io/__init__.py +12 -0
  26. misleep-0.1.0b0/misleep/io/annotation_io.py +46 -0
  27. misleep-0.1.0b0/misleep/io/base.py +388 -0
  28. misleep-0.1.0b0/misleep/io/signal_io.py +111 -0
  29. misleep-0.1.0b0/misleep/preprocessing/__init__.py +10 -0
  30. misleep-0.1.0b0/misleep/preprocessing/channel.py +15 -0
  31. misleep-0.1.0b0/misleep/preprocessing/spectral.py +176 -0
  32. misleep-0.1.0b0/misleep/utils/__init__.py +11 -0
  33. misleep-0.1.0b0/misleep/utils/annotation.py +51 -0
  34. misleep-0.1.0b0/misleep/utils/only4gui.py +61 -0
  35. misleep-0.1.0b0/misleep/utils/others.py +0 -0
  36. misleep-0.1.0b0/misleep/utils/signals.py +73 -0
  37. misleep-0.1.0b0/misleep/viz/__init__.py +12 -0
  38. misleep-0.1.0b0/misleep/viz/hypnogram.py +43 -0
  39. misleep-0.1.0b0/misleep/viz/signals.py +55 -0
  40. misleep-0.1.0b0/misleep/viz/spectral.py +60 -0
  41. misleep-0.1.0b0/misleep.egg-info/PKG-INFO +35 -0
  42. misleep-0.1.0b0/misleep.egg-info/SOURCES.txt +51 -0
  43. misleep-0.1.0b0/misleep.egg-info/dependency_links.txt +1 -0
  44. misleep-0.1.0b0/misleep.egg-info/requires.txt +6 -0
  45. misleep-0.1.0b0/misleep.egg-info/top_level.txt +1 -0
  46. misleep-0.1.0b0/setup.cfg +4 -0
  47. misleep-0.1.0b0/setup.py +77 -0
  48. misleep-0.1.0b0/test/test_annotation_io.py +19 -0
  49. misleep-0.1.0b0/test/test_midata.py +51 -0
  50. misleep-0.1.0b0/test/test_show.py +16 -0
  51. misleep-0.1.0b0/test/test_signal_io.py +38 -0
  52. misleep-0.1.0b0/test/test_signals_viz.py +21 -0
  53. misleep-0.1.0b0/test/test_spectral_viz.py +35 -0
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2018, Raphael Vallat
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.1
2
+ Name: misleep
3
+ Version: 0.1.0b0
4
+ Summary: MiSleep: Mice Sleep EEG/EMG visualization, scoring and analysis.
5
+ Home-page: https://github.com/BryanWang0702/MiSleep/
6
+ Download-URL: https://github.com/BryanWang0702/MiSleep/
7
+ Author: Xueqiang Wang
8
+ Author-email: swang@gmail.com
9
+ Maintainer: Xueqiang Wang
10
+ Maintainer-email: swang@gmail.com
11
+ License: BSD (3-clause)
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: License :: OSI Approved :: BSD License
18
+ Classifier: Operating System :: POSIX
19
+ Classifier: Operating System :: Unix
20
+ Classifier: Operating System :: MacOS
21
+ License-File: LICENSE
22
+ Requires-Dist: numpy>=1.18.1
23
+ Requires-Dist: matplotlib
24
+ Requires-Dist: scipy
25
+ Requires-Dist: pyedflib
26
+ Requires-Dist: hdf5storage
27
+ Requires-Dist: pyqt5
28
+
29
+ # MiSleep
30
+ MiSleep is for EEG/EMG signal processing and visualization
31
+
32
+ ## Get start
33
+ ```shell
34
+ pip install misleep
35
+ ```
@@ -0,0 +1,7 @@
1
+ # MiSleep
2
+ MiSleep is for EEG/EMG signal processing and visualization
3
+
4
+ ## Get start
5
+ ```shell
6
+ pip install misleep
7
+ ```
@@ -0,0 +1,10 @@
1
+ # -*- coding: UTF-8 -*-
2
+
3
+ from .io import *
4
+ from .preprocessing import *
5
+ from .utils import *
6
+ from .viz import *
7
+ from .gui import *
8
+
9
+ __author__ = "Xueqiang Wang <swang9194@gmail.com>"
10
+ __version__ = "0.0.1"
@@ -0,0 +1,10 @@
1
+ import sys
2
+ import os
3
+ sys.path.append(os.getcwd()+'\misleep')
4
+ print(os.getcwd())
5
+
6
+ from misleep.gui.show import show
7
+
8
+ if __name__ == '__main__':
9
+
10
+ show()
@@ -0,0 +1,11 @@
1
+ [gui]
2
+ version = "v0.1.0 Beta"
3
+ updatetime = "2024/04/01"
4
+ marker = ['pat', 'add water', 'third']
5
+ startend = ['Spindle', 'SWA', 'start end label', 'start end label', 'start end label', 'start end label', 'start end label']
6
+ statemap = {"1": "NREM", "2": "REM", "3": "Wake", "4": "INIT"}
7
+ statecolor = {"1": "orange", "2": "skyblue", "3": "red", "4": "white"}
8
+ markerlinecolor = "red"
9
+ startendlinecolor = "blue"
10
+ openpath = E:/workplace/EEGProcessing/00_DATA/20240114_0700_WXQ_3mice_24h/mouse2/mouse2_label.txt
11
+
@@ -0,0 +1,17 @@
1
+ # -*- coding: UTF-8 -*-
2
+ """
3
+ @Project: misleep
4
+ @File: __init__.py
5
+ @Author: Xueqiang Wang
6
+ @Date: 2024/2/22
7
+ @Description:
8
+ """
9
+
10
+ from .about import *
11
+ from .main_window import *
12
+ from .spec_window import *
13
+ from .show import *
14
+ from .resources.misleep import *
15
+ from .utils import *
16
+ from .thread import *
17
+ from .label_dialog import *
@@ -0,0 +1,30 @@
1
+ # -*- coding: UTF-8 -*-
2
+ """
3
+ @Project: MiSleep_v2
4
+ @File: about.py
5
+ @Author: Xueqiang Wang
6
+ @Date: 2024/3/8
7
+ @Description:
8
+ """
9
+ from PyQt5.QtCore import QCoreApplication, Qt
10
+ from PyQt5.QtWidgets import QDialog
11
+
12
+ from misleep.gui.uis.about_ui import Ui_AboutDialog
13
+
14
+
15
+ class about_dialog(QDialog, Ui_AboutDialog):
16
+ def __init__(self, parent=None, version=None, update_time=None):
17
+ """
18
+ Initialize the About dialog of MiSleep
19
+ """
20
+ super().__init__(parent)
21
+
22
+ # Enable high dpi devices
23
+ QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
24
+ self.setupUi(self)
25
+ if version:
26
+ self.VersionLabel.setText(f"Version: {version}")
27
+ if update_time:
28
+ self.UpdateLabel.setText(f"Update: {update_time}")
29
+
30
+
@@ -0,0 +1,144 @@
1
+ # -*- coding: UTF-8 -*-
2
+ """
3
+ @Project: MiSleep_v2
4
+ @File: label_dialog.py
5
+ @Author: Xueqiang Wang
6
+ @Date: 2024/3/28
7
+ @Description:
8
+ """
9
+ from PyQt5.QtCore import QCoreApplication, Qt, QStringListModel
10
+ from PyQt5.QtWidgets import QDialog, QMessageBox
11
+ import json
12
+
13
+ from misleep.gui.uis.label_dialog_ui import Ui_Dialog
14
+ from misleep.gui.thread import SaveThread
15
+
16
+
17
+ class label_dialog(QDialog, Ui_Dialog):
18
+ def __init__(self, parent=None, config=None):
19
+ """
20
+ Initialize the Label dialog of MiSleep
21
+ """
22
+ super().__init__(parent)
23
+
24
+ # Enable high dpi devices
25
+ QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
26
+ self.setupUi(self)
27
+
28
+ # Load configuration
29
+ self.config = config
30
+
31
+ # Type representing marker(0) or start_end(1)
32
+ self._type = 0
33
+
34
+ # List view of selected labels
35
+ self.slm = QStringListModel()
36
+ self.LabelListView.setModel(self.slm)
37
+ self.marker_label = [each[1:-1] for each in
38
+ self.config['gui']['marker'][1:-1].split(', ')]
39
+ self.start_end_label = [each[1:-1] for each in
40
+ self.config['gui']['startend'][1:-1].split(', ')]
41
+ self.label_name = ""
42
+ self.closed = False
43
+
44
+ self.OKBt.clicked.connect(self.submit_label)
45
+ self.CancelBt.clicked.connect(self.cancel_event)
46
+ self.AddBt.clicked.connect(self.add_label)
47
+ self.DeleteBt.clicked.connect(self.delete_label)
48
+
49
+ self.slm.dataChanged.connect(self.update_label_list)
50
+ self.add_or_delete = False
51
+
52
+
53
+ def show_contents(self, idx=0):
54
+ """Show label contents"""
55
+ self.closed = False
56
+
57
+ if self._type == 0:
58
+ self.slm.setStringList(self.marker_label)
59
+ self.LabelListView.setModel(self.slm)
60
+
61
+ if self._type == 1:
62
+ self.slm.setStringList(self.start_end_label)
63
+ self.LabelListView.setModel(self.slm)
64
+
65
+ if idx == -1:
66
+ idx = len(self.slm.stringList()) - 1
67
+ idx = self.slm.index(idx)
68
+ self.LabelListView.setCurrentIndex(idx)
69
+
70
+ def submit_label(self):
71
+ """Triggered by Clicking Ok Button"""
72
+
73
+ if self._type == 0:
74
+ self.label_name = self.marker_label[
75
+ self.LabelListView.selectedIndexes()[0].row()
76
+ ]
77
+
78
+ else:
79
+ self.label_name = self.start_end_label[
80
+ self.LabelListView.selectedIndexes()[0].row()
81
+ ]
82
+
83
+ self.hide()
84
+
85
+ def update_label_list(self):
86
+ """Update label list when edited"""
87
+ if not self.add_or_delete:
88
+ string_list = self.slm.stringList()
89
+
90
+ if self._type == 0:
91
+ self.marker_label = string_list
92
+ if self._type == 1:
93
+ self.start_end_label = string_list
94
+ else:
95
+ self.show_contents(idx=-1)
96
+ self.add_or_delete = False
97
+
98
+ self.save_config()
99
+
100
+ def add_label(self):
101
+ if self._type == 0:
102
+ self.marker_label.append('label')
103
+ elif self._type == 1:
104
+ self.start_end_label.append('start end label')
105
+
106
+ self.add_or_delete = True
107
+ self.update_label_list()
108
+
109
+ def delete_label(self):
110
+ if not self.LabelListView.selectedIndexes():
111
+ return
112
+ if len(self.slm.stringList()) == 1:
113
+ QMessageBox.about(self, "Error", "You can't delete all labels!")
114
+ return
115
+ if self._type == 0:
116
+ self.marker_label.pop(
117
+ self.LabelListView.selectedIndexes()[0].row()
118
+ )
119
+ elif self._type == 1:
120
+ self.start_end_label.pop(
121
+ self.LabelListView.selectedIndexes()[0].row()
122
+ )
123
+ self.add_or_delete = True
124
+ self.update_label_list()
125
+
126
+ def save_config(self):
127
+ """When label changed, save configuration to file, open a new thread"""
128
+ self.config.set('gui', 'MARKER', str(self.marker_label))
129
+ self.config.set('gui', 'STARTEND', str(self.start_end_label))
130
+ save_thread = SaveThread(file=self.config,
131
+ file_path='./misleep/config.ini')
132
+ save_thread.save_config()
133
+ save_thread.quit()
134
+
135
+ def cancel_event(self):
136
+ """Triggered by the `cancel` button"""
137
+ self.closed = True
138
+ self.hide()
139
+
140
+ def closeEvent(self, event):
141
+ event.ignore()
142
+ self.closed = True
143
+ self.hide()
144
+