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 either via the terminal-based lunaC tool or the R extension library lunaR. 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 lunaR; 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 (snaphots) | 
| Canonical signals | Harmonizing EDFs through canonical signal specification | 
| Manipulations | Manipulating signal data | 
| Alignment | Utilities to align data across EDFs | 
| Outputs | Commands to output signals in different formats | 
| FIR filters | FIR filter design and application | 
| Artifacts | Artifacts detection/correction routines | 
| Hypnograms | Characterizations of hypnograms | 
| 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 | 
| Ultradian dynamics | Quantifying ultradian dynamics in epoch-level metrics | 
| 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 | 
| 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,
MAKE-ANNOTS: make new annotations,
WRITE-ANNOTS: write annotation files,
SPANNING: annotation coverage stats,
ESPAN: epoch-based annotation coverage,
META: add meta-data to annotatons,
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 summary 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,
SHIFT: shift a signal,
SCRAMBLE: scramble a signal,
COMBINE: combine multiple signals,
ZC: zero-center signal,
ROBUST-NORM: robust normalization,
EDF: force basic EDF,
RECORD-SIZE: change record size,
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.
Alignment:
ALIGN-EPOCHS: align two EDFs,
ALIGN-ANNOTS: align annotations,
INSERT: insert new channels.
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:
CHEP-MASK: CHannel/EPoch masking,
ARTIFACTS: bad EEG epochs,
LINE-DENOISE: line denoising,
SUPPRESS-ECG: correct ECG artifact,
ALTER: correct artifacts,
EDGER: identify leading/trailing noise.
Hypnograms:
HYPNO: stage summaries,
STAGE: dump stages.
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 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 decompositon,
MSE: Multi-scale entropy,
LZW: LZW compression,
1FNORM: remove the 1/f trend,
TV: total variation denoiser,
ACF: autocorrelation function
Spindles and SO:
SPINDLES: spindles,
SO: slow oscillations.
Coupling/connectivity:
COH: coherence,
CORREL: correlation,
CC: phase-amplitude coupling & phase lag,
PSI: phase slope index,
MI: mutual information,
XCORR: cross-correlation,
TSYNC: cross-correlation & phase delay,
GP: Granger prediction.
Ultradian dynamics:
dynam: option to summarize ultradian dynamics.
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.
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.
Helpers:
--build: build sample-lists,
--validate: validate files,
--repath: alter sample-lists,
--merge: merge EDFs,
--xml: view XMLs,
--xml2: dump EDFs (raw),
EXIT: exit a Luna script,
READ: read whole EDF,
--otsu: Otsu thresholding (file),
OTSU: Otsu thresholding (EDF).
Experimental:
Various: misc. experimental commands.