Skip to content
Automatically score rodent sleep using EEG and EMG recordings
MATLAB Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



11/05/2019 - EEG/EMG data are now only loaded when necessary to avoid out-of-memory errors. Please replace any older versions of AccuSleep with this one.

10/30/2019 - The primary user interface has received a major update, and now allows all recordings from one subject to be processed simultaneously. A small bug was also fixed, the user manual was updated, and error messages should be more helpful.


AccuSleep is a set of graphical user interfaces for scoring rodent sleep using EEG and EMG recordings. To learn more about the algorithms used by this software, please see our preprint at

Please contact zeke (at) berkeley (dot) edu with any questions or comments about the software.

Installation instructions

  1. Make sure your version of MATLAB meets the specifications in the "Requirements" section below.

  2. Click the "Clone or download" button.

  3. Extract the contents of the zip file.

  4. Add AccuSleep to your MATLAB path. You can do this in the MATLAB "Current Folder" window by right-clicking the AccuSleep folder, clicking "Add to Path" --> "Selected Folders and Subfolders", then running the command savepath in the Command Window.

To get started, run AccuSleep_GUI and click the "User manual" button, or run doc AccuSleep_instructions for a full explanation of these functions and the types of input they require.

AccuSleep_GUI provides an interface for most of the functions in this package, but if you want to batch process recordings from multiple subjects, you can call the required functions yourself.

To download the data used for training and testing AccuSleep, please visit


  • MATLAB version 2017b or later
  • Statistics and Machine Learning Toolbox
  • Deep Learning Toolbox
  • Signal Processing Toolbox
  • Image Processing Toolbox


  • AccuSleep_GUI. A user interface for labeling sleep states, either manually or automatically
  • AccuSleep_viewer. A user interface for manually labeling sleep states
  • AccuSleep_classify. Automatically labels sleep states using a pre-trained neural network
  • AccuSleep_train. Trains a neural network for labeling sleep states
  • createCalibrationData. Generates a file that is required for automatic sleep state labeling for a given combination of subject and recording equipment

Tips & Troubleshooting

  • Make sure the required toolboxes are installed.
  • Using more data for calibration will produce better results. However, labeling more than a few minutes of each state probably isn't necessary.
  • If you create a calibration file using one recording, then use it to score another recording automatically, and the accuracy is low, the signals might be different between the two recordings. In this case, it's best to create a new calibration file.
  • If your accuracy seems low no matter what you do, you may wish to train your own network.
  • Make sure to click the 'Help' button in AccuSleep_viewer for a list of keyboard shortcuts.
  • Make sure to run doc AccuSleep_instructions and read the documentation before using this software.
  • If your recordings are very long (>48 hours) and are not displaying properly, try splitting them into smaller files.
  • Please contact zeke (at) berkeley (dot) edu if you find any other issues.


alt test Primary interface (AccuSleep_GUI)

alt test Interface for manual sleep scoring (AccuSleep_viewer)


We would like to thank Franz Weber for creating an early version of the manual labeling interface.

You can’t perform that action at this time.