accusleepy 0.1.0__py3-none-any.whl → 0.3.1__py3-none-any.whl

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.
@@ -1,4 +1,6 @@
1
1
  This is the current brain state configuration.
2
+ You can also choose the default epoch length.
3
+ If you make changes, click 'Save' to store them.
2
4
 
3
5
  Each brain state has several attributes:
4
6
 
@@ -20,5 +22,7 @@ Each brain state has several attributes:
20
22
  influence classification accuracy slightly. The values
21
23
  for all scored brain states must sum to 1.
22
24
 
23
- Note that changing these settings can invalidate existing
24
- label files, calibration files, and trained models!
25
+ Important notes:
26
+ - Changing these settings can invalidate existing label files,
27
+ calibration files, and trained models!
28
+ - Reinstalling AccuSleePy will overwrite this configuration.
@@ -1,3 +1,6 @@
1
+ from accusleepy.constants import BRAIN_STATE_COL, EEG_COL, EMG_COL, UNDEFINED_LABEL
2
+
3
+ MAIN_GUIDE_TEXT = f"""
1
4
  Section 1: Overview of the GUI
2
5
  Section 2: AccuSleePy file types
3
6
  Section 3: Manually assigning brain state labels
@@ -41,17 +44,16 @@ To select a file in the primary interface, you can either use the
41
44
  associated button, or drag/drop the file into the empty box adjacent
42
45
  to the button.
43
46
  Recording file: a .csv or .parquet file containing one column of EEG
44
- data and one column of EMG data. The column names must match the
45
- ones listed in constants.py (EEG_COL, EMG_COL).
46
- Label file: a .csv file with one column whose title matches
47
- BRAIN_STATE_COL in config.py, with entries that are either the
48
- undefined brain state (UNDEFINED_LABEL) or one of the valid
49
- "digit" attributes of your brain states. By default, these are 1-3
50
- and REM = 1, wake = 2, NREM = 3.
47
+ data and one column of EMG data. The column names must be
48
+ {EEG_COL} and {EMG_COL}.
49
+ Label file: a .csv file with one column titled {BRAIN_STATE_COL}
50
+ with entries that are either the undefined brain state, {UNDEFINED_LABEL},
51
+ or one of the digits in your brain state configuration.
52
+ By default, these are 1-3 where REM = 1, wake = 2, NREM = 3.
51
53
  Calibration data file: required for automatic labeling. See Section 4
52
- for details.
54
+ for details. These have .csv format.
53
55
  Trained classification model: required for automatic labeling. See
54
- Section 4 for details.
56
+ Section 4 for details. These have .pth format.
55
57
 
56
58
  -----------------------------------------------------------------------
57
59
  Section 3: Manually assigning brain state labels
@@ -75,6 +77,12 @@ Section 4: Automatically scoring recordings with a classification model
75
77
  Automatic brain state scoring requires the inputs described in
76
78
  Section 3, as well as calibration data files and a trained classifier.
77
79
  If you already have all of these files, proceed to Section 4C.
80
+ Models trained on the AccuSleep dataset are provided at
81
+ https://osf.io/py5eb under /python_format/models/ for epoch lengths of
82
+ 2.5, 4, 5, and 10 seconds. These models are the "default" type, in that
83
+ they use several epochs of data before and after any given epoch when
84
+ scoring that epoch. (The other model type, called "real-time", only
85
+ uses data from the current epoch and several preceding epochs.)
78
86
 
79
87
  --- Section 4A: Creating calibration data files ---
80
88
  Each recording must have a calibration file assigned to it.
@@ -97,12 +105,6 @@ To create a calibration data file:
97
105
  selected recording.
98
106
 
99
107
  --- Section 4B: Training your own classification model ---
100
- Pre-trained classification models are provided with AccuSleePy for
101
- epoch lengths of 2.5, 4, 5, and 10 seconds. These models are the
102
- "default" type, in that they use several epochs of data before and
103
- after any given epoch when scoring that epoch. (The other model type,
104
- called "real-time", only uses data from the current epoch and several
105
- preceding epochs.
106
108
  To train a new model on your own data:
107
109
  1. Add your scored recordings to the recording list. Make sure the
108
110
  sampling rate, recording file, and label file are set for each
@@ -113,11 +115,15 @@ To train a new model on your own data:
113
115
  type models, this must be an odd number. In general, about 30
114
116
  seconds worth of data is enough.
115
117
  4. Choose whether the images used to train the model should be
116
- deleted once training is complete.
117
- 5. Select a directory where the training images will be saved. A
118
+ deleted once training is complete. (It's generally best to
119
+ leave this box checked.)
120
+ 5. Choose whether to create a "default" or "real-time"-type model.
121
+ Note that scoring recordings in the GUI requires a default-type
122
+ model.
123
+ 6. Select a directory where the training images will be saved. A
118
124
  new directory with an automatically generated name will be
119
125
  created inside the directory you choose.
120
- 6. Click the "Train classification model" button and enter a
126
+ 7. Click the "Train classification model" button and enter a
121
127
  filename for the trained model. Training can take some time.
122
128
 
123
129
  --- Section 4C: Automatic labeling ---
@@ -127,8 +133,8 @@ Instructions for automatic labeling using this GUI are below.
127
133
  for each recording. See section 4A for instructions on creating
128
134
  calibration files.
129
135
  3. Click 'Load classification model' to load the trained classification
130
- model. The epoch length used when training this network should be
131
- the same as the current epoch length.
136
+ model. It's important that the epoch length used when training this
137
+ model is the same as the current epoch length.
132
138
  4. If you wish to preserve any existing labels in the label file, and
133
139
  only overwrite undefined epochs, check the box labeled
134
140
  'Only overwrite undefined epochs'.
@@ -140,3 +146,4 @@ Instructions for automatic labeling using this GUI are below.
140
146
  recording list. Labels will be saved to the file specified by
141
147
  the 'Select or create label file' field of each recording. You can
142
148
  click 'Score manually' to visualize the results.
149
+ """
@@ -1,17 +1,16 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: accusleepy
3
- Version: 0.1.0
3
+ Version: 0.3.1
4
4
  Summary: Python implementation of AccuSleep
5
5
  License: GPL-3.0-only
6
6
  Author: Zeke Barger
7
7
  Author-email: zekebarger@gmail.com
8
- Requires-Python: >=3.10,<3.14
8
+ Requires-Python: >=3.10,<3.13
9
9
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
14
  Requires-Dist: fastparquet (>=2024.11.0,<2025.0.0)
16
15
  Requires-Dist: joblib (>=1.4.2,<2.0.0)
17
16
  Requires-Dist: matplotlib (>=3.10.1,<4.0.0)
@@ -19,7 +18,7 @@ Requires-Dist: numpy (>=2.2.4,<3.0.0)
19
18
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
20
19
  Requires-Dist: pillow (>=11.1.0,<12.0.0)
21
20
  Requires-Dist: pre-commit (>=4.2.0,<5.0.0)
22
- Requires-Dist: pyside6 (>=6.8.3,<7.0.0)
21
+ Requires-Dist: pyside6 (>=6.7.1,<6.8.0)
23
22
  Requires-Dist: scipy (>=1.15.2,<2.0.0)
24
23
  Requires-Dist: torch (>=2.6.0,<3.0.0)
25
24
  Requires-Dist: torchvision (>=0.21.0,<0.22.0)
@@ -31,22 +30,31 @@ Description-Content-Type: text/markdown
31
30
  ## Description
32
31
 
33
32
  AccuSleePy is a python implementation of AccuSleep--a set of graphical user interfaces for scoring rodent
34
- sleep using EEG and EMG recordings. If you use AccuSleep in your research, please cite our
33
+ sleep using EEG and EMG recordings. It offers several improvements over the original MATLAB version
34
+ and is the only version that will be actively maintained.
35
+
36
+ If you use AccuSleep in your research, please cite our
35
37
  [publication](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0224642):
36
38
 
37
39
  Barger, Z., Frye, C. G., Liu, D., Dan, Y., & Bouchard, K. E. (2019). Robust, automated sleep scoring by a compact neural network with distributional shift correction. *PLOS ONE, 14*(12), 1–18.
38
40
 
39
- The data used for training and testing AccuSleep are available at https://osf.io/py5eb/
41
+ The data and models associated with AccuSleep are available at https://osf.io/py5eb/
40
42
 
41
43
  Please contact zekebarger (at) gmail (dot) com with any questions or comments about the software.
42
44
 
43
- ## Installation instructions
45
+ ## Installation
44
46
 
45
- WIP
47
+ - (recommended) create a new virtual environment (using
48
+ [venv](https://docs.python.org/3/library/venv.html),
49
+ [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html),
50
+ etc.) using python >=3.10,<3.13
51
+ - (optional) if you have a CUDA device and want to speed up model training, [install PyTorch](https://pytorch.org/)
52
+ - `pip install accusleepy`
53
+ - (optional) download a classification model from https://osf.io/py5eb/ under /python_format/models/
46
54
 
47
- ## Tips & Troubleshooting
55
+ ## Usage
48
56
 
49
- WIP
57
+ `python -m accusleepy` will open the primary interface.
50
58
 
51
59
  ## Acknowledgements
52
60
 
@@ -2,9 +2,9 @@ accusleepy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  accusleepy/__main__.py,sha256=dKzl2N2Hg9lD264CWYNxThRyDKzWwyMwHRXmJxOmMis,104
3
3
  accusleepy/brain_state_set.py,sha256=fRkrArHLIbEKimub804yt_mUXoyfsjJEfiJnTjeCMkY,3233
4
4
  accusleepy/classification.py,sha256=xrmPyMHlzYh0QfNCID1PRIYEIyNkWduOi7g1Bdb6xfg,8573
5
- accusleepy/config.json,sha256=GZV0d1E44NEj-P7X5GKjbxbjjYKWUtXAm29a3vGABVA,430
6
- accusleepy/constants.py,sha256=ceRcWmhec5sATiAsIynf3XFKl0H2IsT_JDfeg7xYbqg,1189
7
- accusleepy/fileio.py,sha256=ojuzDkcJkXok9dny75g8LDieKeMT7P2SFVLyJek6Nd8,6011
5
+ accusleepy/config.json,sha256=F76WRLarMEW38BBMPwFlQ_d7Dur-ptqYmW8BxqnQF4A,464
6
+ accusleepy/constants.py,sha256=PnsPANggyIfMfd6OCR-kNztFOTybUEhMnPeibu5_eEU,1280
7
+ accusleepy/fileio.py,sha256=S5pf_hE-btJPMbrTplKLaQTULSJQoOJ-56LBH79Uz3I,6383
8
8
  accusleepy/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  accusleepy/gui/icons/brightness_down.png,sha256=PLT1fb83RHIhSRuU7MMMx0G7oJAY7o9wUcnqM8veZfM,12432
10
10
  accusleepy/gui/icons/brightness_up.png,sha256=64GnUqgPvN5xZ6Um3wOzwqvUmdAWYZT6eFmWpBsHyks,12989
@@ -17,21 +17,21 @@ accusleepy/gui/icons/save.png,sha256=J3EA8iU1BqLYRSsrq_OdoZlqrv2yfL7oV54DklTy_DI
17
17
  accusleepy/gui/icons/up_arrow.png,sha256=V9yF9t1WgjPaUu-mF1YGe_DfaRHg2dUpR_sUVVcvVvY,3329
18
18
  accusleepy/gui/icons/zoom_in.png,sha256=MFWnKZp7Rvh4bLPq4Cqo4sB_jQYedUUtT8-ZO8tNYyc,13589
19
19
  accusleepy/gui/icons/zoom_out.png,sha256=IB8Jecb3i0U4qjWRR46ridjLpvLCSe7PozBaLqQqYSw,13055
20
- accusleepy/gui/main.py,sha256=clnk3Tuzu1W6IrXjoRU1IaFNkhZZfohNriSZiE2mj6I,53008
21
- accusleepy/gui/manual_scoring.py,sha256=Ce-X4A7pm3Hb0PtiqebF59rpSEMcHhWWhoO-L7rYtTE,40677
20
+ accusleepy/gui/main.py,sha256=IGhSD9vSTO09H72Ou1icbujQfzCy1twTCdeR2Dv8I7s,53055
21
+ accusleepy/gui/manual_scoring.py,sha256=Jfu7uxXk6W4mmq81h4LnLSArP735l0XvbuZq9yYG650,40686
22
22
  accusleepy/gui/mplwidget.py,sha256=f9O3u_96whQGUwpi3o_QGc7yjiETX5vE0oj3ePXTJWE,12279
23
- accusleepy/gui/primary_window.py,sha256=5aXAkX4tI6MkA_zNexlrNzaLFPaIUAtxUdcu8QAJWYI,97441
24
- accusleepy/gui/primary_window.ui,sha256=TswlioQasBB1lMfP8K1BYnh-xTk5odsmjCctP54w53o,135230
23
+ accusleepy/gui/primary_window.py,sha256=eK9yrU6PK5hX1RORjc7DvqCDuDt55iA1LylXp3oh0j8,101850
24
+ accusleepy/gui/primary_window.ui,sha256=NqCSnvlC1mKrWNn034u8avpMF7WudlR8G5jLjFNdTmk,144812
25
25
  accusleepy/gui/resources.qrc,sha256=ByNEmJqr0YbKBqoZGvONZtjyNYr4ST4enO6TEdYSqWg,802
26
26
  accusleepy/gui/resources_rc.py,sha256=Z2e34h30U4snJjnYdZVV9B6yjATKxxfvgTRt5uXtQdo,329727
27
- accusleepy/gui/text/config_guide.txt,sha256=4Tbo1LctcJ_gdcr4Z3jBoLog5CUr8Pccqrgdi3uYU6g,903
28
- accusleepy/gui/text/main_guide.txt,sha256=bIDL8SQKK88MhVqmgKYQWygR4oSfS-CsKNuUUOi2hzU,7684
27
+ accusleepy/gui/text/config_guide.txt,sha256=wz2QtRgd1eXUZMmtfAIVgqvDOtjkOnTOK-IGkLALg4U,1073
28
+ accusleepy/gui/text/main_guide_text.py,sha256=YP-2sexvU5VIeKc1FXHsG0cUCgGfcU4qLD59JRlOMMo,8038
29
29
  accusleepy/gui/text/manual_scoring_guide.txt,sha256=onBnUZJyX18oN1CgjD2HSnlEQHsUscHpOYf11kTKZ4U,1460
30
30
  accusleepy/gui/viewer_window.py,sha256=5PkbuYMXUegH1CExCoqSGDZ9GeJqCCUz0-3WWkM8Vfc,24049
31
31
  accusleepy/gui/viewer_window.ui,sha256=D1LwUFR-kZ_GWGZFFtXvGJdFWghLrOWZTblQeLQt9kI,30525
32
32
  accusleepy/models.py,sha256=Muapsw088AUHqRIbW97Rkbv0oiwCtQvO9tEoBCC-MYg,1476
33
33
  accusleepy/multitaper.py,sha256=V6MJDk0OSWhg2MFhrnt9dvYrHiNsk2T7IxAA7paZVyE,25549
34
34
  accusleepy/signal_processing.py,sha256=-aXnywfp1LBsk3DcbIMmZlgv3f8j6sZ6js0bizZId0o,21718
35
- accusleepy-0.1.0.dist-info/METADATA,sha256=2m9Cniw45DzhegusOsXutTofuxtptRDi7I3I24s3C10,2158
36
- accusleepy-0.1.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
37
- accusleepy-0.1.0.dist-info/RECORD,,
35
+ accusleepy-0.3.1.dist-info/METADATA,sha256=xgwUR8pWzqQp3fi_g6UXCVbvxrL3CdVahoq476bIEaQ,2729
36
+ accusleepy-0.3.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
37
+ accusleepy-0.3.1.dist-info/RECORD,,