Luna: software for the analysis of sleep signal data
Luna is an open-source C/C++ software package for manipulating and analyzing polysomnographic recordings, with a focus on the sleep EEG. Primarily oriented around command-line scripting (lunaC), we are developing various extensions, including a package for the R statistical package (lunaR). Luna is actively under development and we welcome feedback.
The current release is v0.26 (29-Nov-2021): see here for a list of changes/additions.
After downloading Luna, the best place to start is the tutorial. Then work your way through the pages listed in the left-hand side menu. (On devices with smaller screens this may be minimized: if so, click the top left three horizontal bars icon.) In particular, the lunaC describes many key concepts and conventions (many of which are also relevant for the R package).
The Luna package comprises a number of components, primarily:
lunaC, a command-line interface to the Luna C/C++ library
Both lunaC and lunaR are based on the same underlying Luna library: see the reference overview for detailed descriptions of Luna's commands.
Luna and the National Sleep Research Resource
An alternative is to run Luna in a Docker container. If you can install Docker on your machine, this may be a good route to test-drive Luna. We've generated two Docker containers: both include lunaC and lunaR, either in the classic R environment, or via RStudio:
Things Luna aims to do
The reference pages list all currently-supported commands. Main areas are summarized below.
Primary use cases
- Read, manipulate and write large sets of EDF and EDF+ signals
- Filter, resample and re-reference signals
- Generate a variety of (per-epoch) summary statistics
- Statistical artifact detection for EEG channels
- Annotate and mask/filter epochs
- Estimate key features of sleep macro-architecture
- Spectral analyses
- Spindle and slow oscillation detection
- Coherence and cross-frequency coupling
- Multi-channnel, topographical analyses
Things Luna doesn't aim to do
Luna was originally designed to work with the large number of polysomnograms at the NSRR, with a focus on intersecting sleep EEG signals with other annotations. As such, some areas are not well supported, or effectively outside of Luna's scope.
Areas outside of Luna's primary focus
Visual data exploration: Luna is not a highly interactive, point-and-click tool
Methods development platform: although the R extension can support methods development, other tools (including general purpose Matlab packages such as EEGLAB) will naturally be better suited for expert users interested in flexibly altering and developing new analyses
Online signal processing: Luna is set up for all analyses being done offline, i.e. on the entire recording
Support for multiple formats: currently, Luna is mainly based around EDF and EDF+ files (as well as plain text)
Analyses of cardiac and respiratory events: most of Luna's specialized sleep analyses are currently focused on EEG signals (e.g. spindles and slow oscillations)