Command Reference
Below is 1) a list of command domains, and 2) a full list of all commands.
The pages that are linked to describe the Luna command language, which can be used via the terminal-based lunaC tool, the Python lunapi package, or the R extension library lunaR. There is also LunaScope, an interactive point-and-click GUI built on top of lunapi. Importantly, the Luna command language (script syntax) is the same across all these interfaces. Under each section, we tabulate the relevant commands, along with their input parameters and output variables. We give examples using a mixture of lunaC and lunapi; also see lunaC's help function.
Domains
| Domain/Section | Description |
|---|---|
| Summaries | Basic summary commands |
| Annotations | Adding and displaying annotations |
| Expressions | Evaluating more advanced annotation-based expressions |
| Epochs | Epoching signals and epoch-level annotations |
| Masks | Masking epochs based on annotations and other criteria |
| Freezes | Working with dataset freezes (snapshots) |
| Canonical signals | Harmonizing EDFs through canonical signal specification |
| Manipulations | Manipulating signal data |
| Outputs | Commands to output signals in different formats |
| FIR filters | FIR filter design and application |
| Artifacts | Artifacts detection/correction routines |
| Physiological signal analysis | Heart-rate, atonia, and arousal analyses |
| Hypnograms | Characterizations of hypnograms |
| SOAP | Self-contained modelling and evaluation of sleep staging |
| POPS | Sleep staging & evaluation |
| Time/frequency analyses | Power spectral density estimation and other T/F decompositions |
| Spindles and SO | Spindles and slow oscillations |
| Coupling/connectivity | Phase/amplitude coupling, coherence and other multi-signal analyses |
| Interval-based | Time/event-locked signal averaging, peak detection, enrichment |
| Spatial/topographical | Channel locations, spatial filtering and interpolation |
| PSC | Principal spectral components |
| ICA/PCA | Independent components and principal components analyses |
| MS | EEG microstate analysis |
| Clustering | Time-series clustering |
| Association | Association analysis (linear models) |
| Prediction | Prediction models |
| Simulation | Simulation of time-series data |
| Helpers | Auxiliary helper commands |
| Actigraphy | Multi-day actigraphy: circadian metrics and wake/sleep scoring |
| Experimental | Experimental features, under heavy development / for internal use only |
All commands
Summaries:
DESC: simple EDF description,
SUMMARY: EDF description,
HEADERS: EDF header information;
CONTAINS: Indicate whether signals present,
ALIASES: show channel/annotation aliases,
TYPES: show channel types,
VARS: show individual-level variables,
TAG: add output tags,
STATS: basic signal statistics,
SIGSTATS: signal Hjorth parameters,
TABULATE: tabulate signal values,
DUPES: check for signal duplicates.
Annotations:
Formats: overview of annotations,
--xml & --xml2: view NSRR XMLs,
REMAP: remap annotations,
ANNOTS: tabulate annotations,
AXA: pairwise annotation cross-tabulation,
MAKE-ANNOTS: make new annotations,
WRITE-ANNOTS: write annotation files,
SPANNING: annotation coverage stats,
ESPAN: epoch-based annotation coverage,
META: add meta-data to annotations,
A2S: make signal from annotation,
S2A: make annotation from signal,
Expressions:
Expressions: overview of expressions,
EVAL: annotation-based expressions,
TRANS: channel-based expressions,
DERIVE: derive summaries from annotation meta-data.
Epochs:
EPOCH: specify epochs,
EPOCH-ANNOT: attach epoch annotations.
Masks:
MASK: mask epochs,
DUMP-MASK: output epoch masks,
RESTRUCTURE: remove masked epochs,
CHEP: channel/epoch masks.
Freezes & caches:
FREEZE: freeze snapshot,
THAW: revive a prior freeze,
CLEAN-FREEZER: empty freezer,
CACHE: cache operations.
Canonical signals:
CANONICAL: make canonical signals.
Manipulations:
SIGNALS: drop signals,
RENAME: rename signals,
COPY: copy signals,
RESAMPLE: resample signals,
ENFORCE-SR: check for sufficient sample rate,
REFERENCE: re-reference signals,
DEREFERENCE: de-reference signals,
MINMAX: set channel min/max,
uV: force microvolts,
mV: force millivolts,
TIME-TRACK: add time-track,
FLIP: flip signal,
SCALE: scale a signal,
CLIP: clip a signal,
COMBINE: combine multiple signals,
ZC: zero-center signal,
ROBUST-NORM: robust normalization,
RECORD-SIZE: change record size,
ALIGN: align channels/records,
EDF-MINUS: convert EDF+ to EDF,
ANON: anonymize EDF,
SET-HEADERS: set EDF headers,
SET-VAR: set Luna variables,
SET-TIMESTAMPS: set EDF record time,
RECTIFY: rectify a signal,
REVERSE: reverse a signal,
MOVING-AVERAGE: moving average filters.
Outputs:
WRITE: write EDF,
MATRIX: signals to text,
HEAD: signals snippet to text,
DUMP-RECORDS: dump by record,
RECS: info on EDF record structure,
SEGMENTS: continuous intervals,
SEDF: write summary EDF,
Filters:
FILTER: apply FIR,
FILTER-DESIGN: FIR properties.
Artifacts:
QC: multi-domain PSG signal quality control,
EDGER: identify leading/trailing noise,
CHEP-MASK: CHannel/EPoch masking,
ARTIFACTS: bad EEG epochs,
POL: signal polarity diagnostics,
LINE-DENOISE: line denoising,
SUPPRESS-ECG: correct ECG artifact,
ALTER: correct artifacts.
Physiological signal analysis:
HRV: estimate heart-rate variability metrics from ECG,
RAI: calculate the REM atonia index from chin EMG,
AROUSALS: detect candidate sleep arousals from EEG and optional EMG.
Hypnograms:
HYPNO: stage summaries,
STAGE: dump stages,
DYNAM: summarize epoch-level outputs by NREM cycles.
SOAP:
SOAP: single observation & probabilities,
REBASE: change epoch length,
PLACE: align stages,
POPS:
RUN-POPS: predict sleep stages,
POPS: lower-level POPS command,
EVAL-STAGES: evaluate external stages,
--eval-stages: evaluate external stages,
POPS train: create level 1 training features,
--pops: train models.
Time/frequency analysis:
PSD: Welch PSD,
MTM: Multi-taper PSD,
FFT: Fourier transform,
IRASA: IRASA spectral analysis,
HILBERT: Hilbert transform,
CWT: wavelet transform,
CWT-DESIGN: CWT properties,
PCOUPL: generic phase coupling,
EMD: Empirical mode decomposition,
MSE: Multi-scale entropy,
LZW: LZW compression,
1FNORM: remove the 1/f trend,
TV: total variation denoiser,
ACF: autocorrelation function,
DFA: detrended fluctuation analysis.
Spindles and SO:
SPINDLES: spindles,
SO: slow oscillations.
Coupling/connectivity:
CORREL: correlation,
XCORR: cross-correlation,
COH: coherence,
PSI: phase slope index,
IPC: instantaneous phase coherence,
CC: phase-amplitude coupling & phase lag,
MI: mutual information,
GP: Granger prediction.
Interval-based:
OVERLAP: single-sample overlap analysis,
--overlap: multi-sample overlap analysis,
MEANS: signal mean by annotation,
PEAKS: detect/cache peaks,
Z-PEAKS: detect/cache peaks (Z method),
TLOCK: time-locked averaging,
S2C: signal-to-cycle annotation and summaries.
PSC:
--psc: estimate components,
PSC: project new samples.
Spatial/topographical:
CLOCS: set channel locations,
SL: surface Laplacian,
INTERPOLATE: epoch/channel interpolation.
ICA:
ICA: fit ICA,
ADJUST: adjust given ICs,
SVD: fit SVD/PCA.
Microstates:
MS: EEG microstates,
--kmer: sequence motifs,
--cmp-maps: group/indiv map spatial analysis,
--label-maps: label maps given a template,
--correl-maps: spatial correlations.
Clustering:
EXE: time-series clustering.
Association:
--gpa-prep: general permutation-based association model prep,
--gpa: general permutation-based association models,
CPT: association models.
Prediction:
PREDICT: prediction models.
Simulation:
SIMUL: simulate signals,
SIGGEN: basic signal simulation.
Actigraphy:
DAYS: day and clock-time annotations,
ACTIG: circadian metrics and wake/sleep scoring.
Helpers:
--build: build sample-lists,
--validate: validate files,
--repath: alter sample-lists,
--merge: merge EDFs,
--bind: bind files to IDs,
--xml: view XMLs,
--xml2: dump EDFs (raw),
--otsu: Otsu thresholding (file),
OTSU: Otsu thresholding (EDF).
Experimental:
Various: misc. experimental commands,
ALIGN-EPOCHS: align epochs between files,
ALIGN-ANNOTS: realign annotations given an ALIGN-EPOCHS solution,
INSERT: estimate lags and insert channels from another EDF.