Data Access and Visualization for Sleep Toolbox
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Data Access and Visualization for Sleep Toolbox


The DAVS-Toolbox is a collection of MATLAB scripts and GUIs for accessing and visualizing polysnonmography (PSG) data. Each routine includes test scripts and test files which allow the user to evaluate performance, verify steps, and serve as a brief tutortial.

MATLAB script files are available for each of the DAVS-toolbox components. Click on the component name to access the prefferred download site. Components are posted on the MATLAB file exchange website and GITHUB. It is reccomended that the MATLAB website be used to download if available. Links to the GITHUB site for MATLAB deposited routines are also provided for individuals who wish to contribute bug fixes, revisions, and extensions. GITHUB released sections also include figure and excel output examples generated by the DAVS toolbox. Commonly used DAVS toolbox components are available at the MATLAB File Exchange area. Tutorials for the EDF loaders are hosted on the National Sleep Research Resource website.

Target Audience

Sleep researchers and engineers applying novel techniques to sleep data.


The Data Access and Visualization For Sleep (DAVS) Toolbox is a set of MATLAB scripts and utilities (GUI) that can be used to review and visualize large numbers of sleep studies stored as a European Data Format (EDF) file and the associated annotations saved in an XML format. The DAVS toolbox includes four components: Data Access, Data Manipulation, Data Visualization, and Data Utilities.

Data Access. The Data Access components include low level file routines for loading and writing EDF files. The data access functions have been tailored to sleep applications and include support for accessing data by signal and sleep epoch. A class version of the loader includes a checker that compares the EDF header and signal information to original EDF standard, support for identifying EDF files in a folder, and support for plotting signals. The class version of the loader is designed to support GUI development and signal processing applications by providing dependent variables which provide quick access to commonly used signal parameters. For example, the sampling rates for each of the loaded signals can be accessed directly without computing information from the header and signal sections of the EDF. The EDF write function allows for header, signal information, and signal data to be modified in addition to creating new EDF files. Included in the EDF write function is a simple signal generator, which is used to save test data to an EDF file. The annotation loader can be used to access sleep stage and event information stored in an XML file. The annotation loader can be used to create a Hypnogram or to export events to an excel file.

Data Manipulation. Provides support for de-identifying EDF files and summarizing the contents of EDF files stored in a directory. The summarizing functionality can be configured to summarize headers and signal labels as well as check that expected signals are present in identified files. The data manipulation functions can be used prior to large scale analysis to verify EDF contents. Alternatively, the functionality can be integrated within analysis pipeline to verify analysis requirements prior to proceeding with an analysis step.

Data Visualization. Signal raster plots can be used to create raster plots from signals stored within an EDF file and annotation event timing can be overlaid on the signals. The number of signals on a page and the x-axis time scale are pre-configured to settings most commonly used in sleep and circadian applications. Either MATLAB figures can be generated or the collection of figures can be saved to a power point file. HeatMaps can be created from data signals stored with an EDF file and contain similar pre-configured settings for sleep and circadian application as the signal raster plotting program. Single signal heat maps or a panel of heat maps from user selected signals can also be created.

Data Utilities. Two utilities with GUIs which use most of the script files in the DAVS toolbox are also provided. The SignalRasterView utilities can be uses to inspect the contents of an EDF or to check the EDF prior to loading. Signal raster plots can be generated from the same interface. A second tool, BlockEdfSummarize, can be used to generate header and signal content summaries simply by selecting the folder to investigate. Versions of these tools are provided as MATALB script files, a MATLAB App, and a Windows compiled tool.

Collectively the script files and data utilities provide significant support for reviewing and preparing a large number of files for analysis.

DAVS Toolbox Content

Data Access

  • BlockEdfLoad (git). An efficient EDF loader that provides several options for accessing header and signal information stored in an EDF file. Specific signals and selected 30 second epochs can be retrieved.
  • BlockEdfLoadClass (git)(rel). Class version of BlockEdfLoad. Dependent variables are added that provide quick access to EDF header content. The class includes an EDF checker and support for creating EDF file lists.
  • BlockEdfWrite (git). An EDF creation function designed to worked in conjunction with BlockEdfLoad and BlockEdfLoadClass. The function can be used to record experimental data and to generate test data.
  • LoadCompumedicsAnnotationClass(rel). Load sleep stage and event information from a Compumedics file. Generate a hypnogram from stage data.

Data Manipuation

  • BlockEdfDeidentify (git). Function overwrites the subject id and study date fields in the EDF header.
  • BlockEdfSummarizeClass. BlockEdfSummarizeClass can be used to summarize the contents of a folder which contains EDF files with the associated annotation file (XML) files. The class is configured to create header and signal summaries, which are written to excel files. An EDF check summary, which compares the EDF content to the EDF specification, can be exported to an excel file.
  • GetMatchedSleepEdfXmlFiles(rel). Function searches recurrsively within a folder for EDF files. The function assumes EDF files are named as 'prefix'.* and that annotation files are stored in the same folder as the EDF. The function assumes annotaion files are stored as XML files ('prefix'.XML.edf). Note that the assumed file structure is designed to work with data formats supported by the [National Sleep Research Resource](https:\

Data Visualization

Data Utilities

  • SignalRasterView (git)(rel). SignalRasterViewFig is a utility for investigating the contents of an EDF file. The utility (GUI) can be used to compare the EDF contents to the EDF specification, view the EDF headers, to create raster plots of the EDF signals, and to create a power point summary of the generated raster plots.
  • BlockEdfSummarizeFig(rel). The simple GUI can be used to summarize and check EDF files stored within a folder.