Skip to content

Luna: software for the analysis of sleep signal data

Luna is freely available, open-source C/C++ software for manipulating and analyzing polysomnographic recordings stored as EDFs, with a focus on the sleep EEG. Primarily oriented around command-line scripting, we are developing various extensions, including a package (lunaR) for the R statistical package. Luna is actively under development: we welcome feedback and requests for functionality.

Getting started

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.)

The Luna package comprises a number of components, primarily:

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

If you want to use Luna to work with data from the NSRR, be sure to check out this page.

Installation options

You can install Luna in two different ways. The standard approach is to install the software (either as binary executables or from source) on your local machine or server:

img

An alternative is to run Luna in a Docker container. If you can install Docker on your machine, this is the easiest 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:

img

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

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 solely based around EDF and EDF+ files

  • Topographical analyses: currently, Luna's main focus is on single channels or pairs of channels (e.g. spectral coherence), although functions for full multi-channel analyses are in development

  • 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)