Skip to content

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.25.5 (24-May-2021): see here for a list of changes/additions.

Documentation for new features

This release is being posted now because we wanted the relatively large number of additions and improvements in the core functionality of Luna (both in terms of speed and robustness) to be made available and the corresponding documentation updated. See here for a full list of changes. All core updates have been reflected in these documentation pages.

This release also contains a number of relatively new, major components (e.g. automated staging, EEG microstate analysis, ICA). The documentation for many of these newer components (some of which are quite involved) is currently sparse, or is effectively just a place-holder, however: we antipcate adding fuller documentation and a series of vignettes in the coming weeks.

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

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, please see this page.

Installation options

You can install Luna in a number of ways. The easiest approach is to download binary executables; you can also compile from source):

img

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:

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