misleep 0.2.2__tar.gz → 0.2.3__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.
- {misleep-0.2.2 → misleep-0.2.3}/PKG-INFO +2 -2
- {misleep-0.2.2 → misleep-0.2.3}/README.md +1 -1
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/auto_stage.py +24 -2
- {misleep-0.2.2 → misleep-0.2.3}/misleep/config.ini +1 -1
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/dialog.py +1 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/main_window.py +2 -2
- {misleep-0.2.2 → misleep-0.2.3}/misleep.egg-info/PKG-INFO +2 -2
- {misleep-0.2.2 → misleep-0.2.3}/setup.py +1 -1
- {misleep-0.2.2 → misleep-0.2.3}/LICENSE +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/__main__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/auto_stage_model/EEG_F_lightgbm_20241221.pkl +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/auto_stage_model/EEG_P_lightgbm_20241221.pkl +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/classification.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/detection.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/about.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/resources/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/resources/entire_logo.png +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/resources/logo.png +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/resources/misleep.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/resources/misleep.qrc +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/show.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/spec_window.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/thread.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/SWA_detect_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/about_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/auto_stage_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/horizontal_line_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/label_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/main_window_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/save_data_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/spec_window_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/spindle_detect_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/state_spectral_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/uis/transfer_result_dialog_ui.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/gui/utils.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/io/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/io/annotation_io.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/io/base.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/io/signal_io.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/preprocessing/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/preprocessing/channel.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/preprocessing/signals.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/preprocessing/spectral.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/utils/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/utils/annotation.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/utils/logger_handler.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/utils/signals.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/viz/__init__.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/viz/hypnogram.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/viz/signals.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep/viz/spectral.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep.egg-info/SOURCES.txt +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep.egg-info/dependency_links.txt +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep.egg-info/requires.txt +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/misleep.egg-info/top_level.txt +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/setup.cfg +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_annotation_io.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_loadmat73.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_midata.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_show.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_signal_io.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_signals_viz.py +0 -0
- {misleep-0.2.2 → misleep-0.2.3}/test/test_spectral_viz.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: misleep
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: MiSleep: Mice Sleep EEG/EMG visualization, scoring and analysis.
|
|
5
5
|
Home-page: https://github.com/BryanWang0702/MiSleep/
|
|
6
6
|
Download-URL: https://github.com/BryanWang0702/MiSleep/
|
|
@@ -82,7 +82,7 @@ There is a config.ini in the root directory of MiSleep source package, multiple
|
|
|
82
82
|
|
|
83
83
|
4. Auto stage
|
|
84
84
|
|
|
85
|
-
Finally, now we have the auto stage function! Check it in the tool.
|
|
85
|
+
Finally, now we have the auto stage function! Check it in the tool. The overall test accuracy of NREM and Wake is higher than 90%, and for REM, the accuracy is higher than 80%. Currently the model's result is rather fragmented in the state transition segments, we will add some constraints to fix this.
|
|
86
86
|
|
|
87
87
|
**Future**: Open for suggestions :).
|
|
88
88
|
|
|
@@ -48,7 +48,7 @@ There is a config.ini in the root directory of MiSleep source package, multiple
|
|
|
48
48
|
|
|
49
49
|
4. Auto stage
|
|
50
50
|
|
|
51
|
-
Finally, now we have the auto stage function! Check it in the tool.
|
|
51
|
+
Finally, now we have the auto stage function! Check it in the tool. The overall test accuracy of NREM and Wake is higher than 90%, and for REM, the accuracy is higher than 80%. Currently the model's result is rather fragmented in the state transition segments, we will add some constraints to fix this.
|
|
52
52
|
|
|
53
53
|
**Future**: Open for suggestions :).
|
|
54
54
|
|
|
@@ -5,6 +5,7 @@ import pandas as pd
|
|
|
5
5
|
from scipy import stats
|
|
6
6
|
import antropy
|
|
7
7
|
import joblib
|
|
8
|
+
import copy
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def filter_power_line_noise(data, sf, noise_band='50-100-150'):
|
|
@@ -36,8 +37,10 @@ def split_window_data(data, sf, state, window_length=20, stride_length=5):
|
|
|
36
37
|
return []
|
|
37
38
|
|
|
38
39
|
window_data = []
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
# Make sure we have enough data point of the final segment
|
|
41
|
+
data_sec_length = floor(data.shape[0] / sf)
|
|
42
|
+
for i in range(0, data_sec_length-stride_length, stride_length):
|
|
43
|
+
window = data[int(i*sf):int((i+window_length)*sf)]
|
|
41
44
|
window_data.append([window, state])
|
|
42
45
|
|
|
43
46
|
return window_data
|
|
@@ -99,6 +102,24 @@ def get_data_features(data, sf, data_format='EEG'):
|
|
|
99
102
|
|
|
100
103
|
return window_feature_df
|
|
101
104
|
|
|
105
|
+
def result_constraints(pred_label):
|
|
106
|
+
"""
|
|
107
|
+
Once finished the prediction, add some constraints to make the result more smooth
|
|
108
|
+
1. No REM after Wake, set to NREM
|
|
109
|
+
2. All one epoch between two same state will be set to the around state
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
pred_label = copy.deepcopy(pred_label)
|
|
113
|
+
for idx in range(1, len(pred_label)-1):
|
|
114
|
+
label_ = pred_label[idx]
|
|
115
|
+
if label_ == 3 and pred_label[idx+1] == 2: # REM after Wake
|
|
116
|
+
pred_label[idx+1] = 1
|
|
117
|
+
if pred_label[idx-1] ==pred_label[idx+1]: # Same state previous and after
|
|
118
|
+
pred_label[idx] = pred_label[idx-1]
|
|
119
|
+
|
|
120
|
+
return pred_label
|
|
121
|
+
|
|
122
|
+
|
|
102
123
|
def auto_stage_gbm(EEG, EMG, sf, EEG_channel='F'):
|
|
103
124
|
"""
|
|
104
125
|
Auto stage with lightgbm method
|
|
@@ -132,5 +153,6 @@ def auto_stage_gbm(EEG, EMG, sf, EEG_channel='F'):
|
|
|
132
153
|
gbm_model = joblib.load(r'./misleep/analysis/auto_stage_model/EEG_P_lightgbm_20241221.pkl')
|
|
133
154
|
|
|
134
155
|
pred_label = gbm_model.predict(window_feature_df, num_iteration=gbm_model.best_iteration_)
|
|
156
|
+
pred_label = result_constraints(pred_label)
|
|
135
157
|
pred_label = [item for each in pred_label for item in [each]*5]
|
|
136
158
|
return pred_label
|
|
@@ -1626,8 +1626,8 @@ class main_window(QMainWindow, Ui_MiSleep):
|
|
|
1626
1626
|
return
|
|
1627
1627
|
auto_stage_lst = self.auto_stage_dialog.auto_stage(self.midata)
|
|
1628
1628
|
|
|
1629
|
-
#
|
|
1630
|
-
self.mianno._sleep_state[:len(auto_stage_lst)] = auto_stage_lst
|
|
1629
|
+
# Not sure which one is shorter, so get the minimum one
|
|
1630
|
+
self.mianno._sleep_state[:min(len(self.mianno._sleep_state),len(auto_stage_lst))] = auto_stage_lst[:min(len(self.mianno._sleep_state),len(auto_stage_lst))]
|
|
1631
1631
|
|
|
1632
1632
|
self.is_saved = False
|
|
1633
1633
|
self.AnnotationPathLabel.setText('*Annotation path:')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: misleep
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: MiSleep: Mice Sleep EEG/EMG visualization, scoring and analysis.
|
|
5
5
|
Home-page: https://github.com/BryanWang0702/MiSleep/
|
|
6
6
|
Download-URL: https://github.com/BryanWang0702/MiSleep/
|
|
@@ -82,7 +82,7 @@ There is a config.ini in the root directory of MiSleep source package, multiple
|
|
|
82
82
|
|
|
83
83
|
4. Auto stage
|
|
84
84
|
|
|
85
|
-
Finally, now we have the auto stage function! Check it in the tool.
|
|
85
|
+
Finally, now we have the auto stage function! Check it in the tool. The overall test accuracy of NREM and Wake is higher than 90%, and for REM, the accuracy is higher than 80%. Currently the model's result is rather fragmented in the state transition segments, we will add some constraints to fix this.
|
|
86
86
|
|
|
87
87
|
**Future**: Open for suggestions :).
|
|
88
88
|
|
|
@@ -11,7 +11,7 @@ MAINTAINER_EMAIL = "swang@gmail.com"
|
|
|
11
11
|
URL = "https://github.com/BryanWang0702/MiSleep/"
|
|
12
12
|
LICENSE = "BSD (3-clause)"
|
|
13
13
|
DOWNLOAD_URL = "https://github.com/BryanWang0702/MiSleep/"
|
|
14
|
-
VERSION = "0.2.
|
|
14
|
+
VERSION = "0.2.3"
|
|
15
15
|
|
|
16
16
|
INSTALL_REQUIRES = [
|
|
17
17
|
"numpy>=1.18.1",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/auto_stage_model/EEG_F_lightgbm_20241221.pkl
RENAMED
|
File without changes
|
{misleep-0.2.2 → misleep-0.2.3}/misleep/analysis/auto_stage_model/EEG_P_lightgbm_20241221.pkl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|