Hypnograms
Hypnograms summarize sleep stages across time. If valid staging
annotations are present, a hypnogram appears both in the main signal
view and in the hypnogram dock. Stages must map to N1, N2, N3,
R, W, and ?; if other labels are used, they can be remapped
via a parameter file.

This tab also reports simple summary statistics such as stage durations and WASO. Lights out/on times can be adjusted before recalculating the output with Run HYPNO.

Staging evaluation (SOAP)
As described here, SOAP evaluates signal/staging consistency. When staging data are present, select a channel and press SOAP to generate kappa coefficients and a SOAP-hypnodensity plot:

Automated Staging (POPS)
Screenshots predate v1.9.0
The POPS screenshots below show the older controls (Run POPS, Emit PP, Hypnodensities). In the current version these are Stage (30s) / Hypno (5s), CODA, and Posteriors, as described in the text.
Lunascope can download the POPS resource bundle for you. Use either:
-
Project / Download POPS Resources...
-
the Get... button beside the POPS path field

This downloads the current POPS bundle, extracts the model files, updates the POPS folder field to the resolved model directory, and remembers that location for later launches.
If you prefer, you can still download and expand the POPS resource
.zip
manually and point the POPS folder box to that location yourself, or
use a configuration file to set pops-path.
As described here, POPS performs automatic sleep staging and hypnodensity visualization.
Select one or more suitable EEG channels, point Lunascope to the
downloaded POPS model files, and set the Model (the model library
basename; the default is s2a). There are then two ways to run POPS:
-
Stage (30s) runs standard POPS staging on 30-second epochs and produces a hypnogram of predicted stages.
-
Hypno (5s) runs POPS at 5-second resolution and writes the posterior-probability channels (
PP_N1,PP_N2,PP_N3,PP_R,PP_W) into the in-memory EDF. This requires the in-memory EDF to be restructured to 5-second data records; Lunascope asks for confirmation the first time you use it in a session. ThesePP_*channels are what the Hypnodensity viewer uses.
If you select multiple comparable EEG channels, they are treated as equivalent inputs for prediction. In that mode POPS predicts from each candidate channel separately and then uses the most confident prediction for each epoch. See the Luna POPS prediction documentation for the underlying details.
The CODA option applies a second-stage CODA model on top of the
primary POPS predictions. It is on by default, but is only available
(and otherwise greyed out) when the selected model has a matching
<model>.coda30.mod file in the POPS folder. The default can be set
with pops-coda.
After a run, the Posteriors option switches the plot between the hypnodensity (checked) and the predicted hypnogram (unchecked):

Hypnogram, SOAP, and POPS plots are drawn against elapsed time, so masked or otherwise missing epochs appear as gaps rather than being squeezed together.
There is also an option to ignore existing staging. In that mode kappa statistics are not computed, but all epochs are included; otherwise epochs marked as unknown (?) are excluded from automated staging. A fuller set of POPS metrics is written to the primary Output dock; here the stage-specific metrics are shown:

POPS saves new annotations (N1, N2, and so on, or if staging already exists, pN1, pN2, and so on to indicate predicted stage). These annotations can then be selected from the Annotations table, used in Masks, or incorporated into other Luna scripts.
If you need different options, you can invoke RUN-POPS or POPS directly from the Console instead of this convenience interface.
Hypnodensity viewer
The Hypnodensity viewer is a separate window for browsing POPS
hypnodensities across a whole cohort, summarized by Luna's HDSTATS
command and projected onto a fitted principal-components (HDSTATS-PC)
model. Open it from the Views menu or with C-Shift-H (C-H
also works where the operating system does not reserve it).
Every record in the current sample list must already contain the
PP_N1, PP_N2, PP_N3, PP_R, and PP_W channels, e.g. produced
by POPS with posterior emission (as with Hypno (5s) above) and saved
back to EDF. Records without them are listed under Exclusions….
To get started:
-
choose a projection model with Projection model…, or press Download HDPC (also under Project / Download HDPC...) to fetch the current core HDSTATS-PC model and its descriptor; an optional descriptor file (Descriptor…) supplies human-readable PC and feature labels
-
press Calculate / resume: each record is run through
HDSTATS pc-proj=<model>in parallel worker processes (using the current parameters); records already calculated and unchanged on disk are reused, so an interrupted run can be resumed -
use Save cache… / Open cache… to store the results as a self-contained
.hdstats.jsonfile (with a matching.traces.npz) so a cohort does not need to be recalculated
The window has two tabs:
-
Model PCs / features lists the model's components and input features; click a PC or feature to see its loadings, optionally hiding loadings below a minimum absolute value.
-
Cohort browser shows one row per individual with a hypnodensity thumbnail, recording duration, and up to two chosen values (Browser values…: PC scores, HDSTATS features, or columns from a TSV loaded with Load TSV…). Selecting a row shows that individual's PC scores and a full-size hypnodensity (arrow keys, wheel, or drag to zoom and pan; double-click to reset). Thumbnails can show the full recording or the HDSTATS sleep period plus flanks, at normalized or absolute width, and posteriors can be shown as five classes, NREM/REM/wake, or wake/sleep.
Individuals can be flagged with F (★) for follow-up, and opened in
the main window's sample list with O. Flagged… lists flagged
individuals with editable notes, and can save, load (merging with the
current list), and copy flag lists.
Previous: Spectrograms | Next: Masks