HomeSleep Medicine PolysomnographyPolysomnography Sleep Stage Scoring Simulator

😴 Polysomnography Sleep Stage Scoring Simulator

This simulation allows users to practice scoring sleep stages based on polysomnography data. It provides a detailed interface for identifying and categorizing various physiological parameters during different phases of sleep.

Sleep Medicine Polysomnography2DModerate60 FPS
polysomnography-sleep-stage-scoring ↗ Open standalone

Montage Setup — Wiring the Sleeping Brain and Body

A diagnostic polysomnogram (PSG) begins hours before the patient falls asleep, with a sleep technologist meticulously placing dozens of electrodes and sensors according to the American Academy of Sleep Medicine (AASM) Manual for the Scoring of Sleep and Associated Events. Every downstream stage determination depends on signal quality established during this setup — a poorly placed electrode or a missed calibration step can render an entire night unscoreable.

  • 3: AASM minimum EEG derivations (F4-M1, C4-M1, O2-M1)
  • 2: EOG electrodes (E1-M2, E2-M2 (canthi))
  • 3: Chin EMG electrodes (submentalis, redundant pair)
  • 200 Hz: Minimum EEG sampling rate (500 Hz recommended)

The 10-20 system and full PSG montage

Electrode placement follows the International 10-20 System, which locates scalp sites as percentages (10% or 20%) of skull landmark distances (nasion to inion, preauricular points). The AASM-recommended minimum montage records three EEG derivations referenced to the contralateral mastoid: F4-M1 (frontal), C4-M1 (central), and O2-M1 (occipital) — with F3, C3, and O1 wired as backups in case the primary channel fails overnight.

Beyond EEG, a complete diagnostic montage includes: two EOG channels (E1 placed 1 cm below and lateral to the left outer canthus, E2 placed 1 cm above and lateral to the right outer canthus, both referenced to M2) to capture the corneoretinal dipole as the eyes move; three chin EMG electrodes over and below the mentalis/submentalis muscles to track tone loss during REM; a single modified lead-II ECG; nasal pressure and oronasal thermal airflow sensors; piezoelectric or inductance plethysmography belts around the thorax and abdomen to record respiratory effort; a finger pulse oximeter for SpO2; and bilateral anterior tibialis EMG leads to catch periodic limb movements.

Electrode impedance is checked and adjusted below 5 kΩ before recording begins, since higher impedance introduces 60 Hz line noise and artifact that can be mistaken for genuine high-frequency EEG activity.

A full diagnostic PSG montage typically streams 16-20 simultaneous channels at 200-500 samples per second — over a single 8-hour study, that is more than 500 million individual data points that a scorer or an automated classifier must condense into 960 discrete 30-second epoch labels.

Biocalibration — proving each channel works before lights-out

Immediately after hookup, the technologist runs a structured biocalibration protocol while the patient is still awake, asking them to perform a scripted sequence: eyes open for 30 seconds (to confirm the alpha rhythm attenuates when the operator asks the patient to open their eyes), eyes closed for 30 seconds (to confirm a clean 8-13 Hz occipital alpha rhythm is present), look left-right-left-right (to calibrate the EOG deflection direction and polarity), blink five times (to verify EOG amplitude and confirm eye-blink artifact contaminates frontal EEG in a recognizable way), clench the jaw (to check chin EMG responsiveness and set gain), and hold the breath for 10 seconds (to confirm airflow and effort channels flatline appropriately and SpO2 responds after resumption).

This calibration record becomes the reference the scorer returns to throughout the night: it establishes what a clean, artifact-free alpha rhythm looks like for this specific patient, what amplitude a genuine eye movement produces on this specific EOG montage, and what chin EMG tone looks like at maximal voluntary contraction versus quiescence — all essential context because normal EEG amplitude varies meaningfully between individuals.

Why the epoch is 30 seconds

The AASM standardized the scoring epoch at 30 seconds, a convention inherited from the original Rechtschaffen and Kales manual of 1968, chosen because it was the length of a single page of continuously scrolling paper strip-chart output at standard polygraph paper speeds — short enough to capture transient events like K-complexes and spindles within their surrounding context, yet long enough to characterize sustained rhythms like delta or REM sawtooth activity that develop over several seconds.

Each epoch is assigned exactly one stage — Wake, N1, N2, N3, or REM — based on the rule that the stage occupying the greatest proportion of the epoch determines its label, with several override rules (e.g., any epoch containing a K-complex or spindle, in the absence of qualifying REM or wake, is scored N2 even if that pattern occupies less than half the epoch). An 8-hour recording therefore yields 960 sequential epochs, each independently classified, which are then concatenated into the hypnogram — the master timeline of a night's sleep architecture.

From paper strip-charts to digital PSG

Classic sleep laboratories recorded on ink-pen polygraphs, physically printing continuous multi-channel strip-charts at a fixed paper speed — technologists would flip and file literal reams of paper each morning, and a night's recording could weigh several kilograms in raw output. Digital PSG systems replaced this workflow starting in the 1990s, storing every channel as time-stamped digital samples that can be re-displayed at any paper speed, filter setting, or amplitude scale after the fact, and searched or auto-annotated by software.

Digital acquisition also enabled automated event-detection algorithms that flag candidate spindles, K-complexes, respiratory events, and limb movements for a human scorer to confirm or reject, and, more recently, deep-learning classifiers trained on large annotated PSG datasets that can propose an entire epoch-by-epoch hypnogram directly — though AASM-accredited clinical labs still require a credentialed sleep technologist to review and finalize every stage assignment before a report is issued.

Wake to N1 — The First Descent Into Sleep

The transition from relaxed wakefulness into stage N1 is the most subtle and often the most contested transition a scorer must judge. There is no single moment of "falling asleep" visible on the tracing — instead, the dominant posterior alpha rhythm of quiet wakefulness gradually fragments and gives way to a lower-voltage, mixed-frequency pattern that defines N1, the lightest and most transient sleep stage.

  • 8-13 Hz: Wake alpha rhythm frequency (posterior-dominant, eyes closed)
  • <50%: N1 scoring criterion (alpha present in the epoch)
  • 2-5%: N1 share of total sleep time (in healthy young adults)
  • 10-20 min: Normal sleep-onset latency (lights-out to first N1 epoch)

Alpha attenuation — the defining criterion

During relaxed wakefulness with eyes closed, a healthy adult's occipital EEG is dominated by a sinusoidal 8-13 Hz alpha rhythm, typically 20-60 µV in amplitude, that waxes and wanes and attenuates promptly when the eyes open. The AASM rule for scoring the wake-to-N1 transition is precise: N1 begins at the first epoch in which alpha rhythm occupies less than 50% of the epoch and is replaced by relatively low-amplitude, mixed-frequency (primarily 4-7 Hz theta) activity.

For patients who do not generate a clear alpha rhythm even while awake (roughly 10% of the general population have "low-voltage" or alpha-poor EEG), the AASM manual permits alternative N1 criteria: slowing of background frequency by ≥1 Hz from wake, or the appearance of vertex sharp waves. This is one of several places where sleep staging requires clinical judgment layered on top of the nominal rule set — automated scoring algorithms that rely solely on spectral alpha power can misclassify alpha-poor sleepers.

N1 is the shortest and most fragile sleep stage: a person aroused during N1 will often insist they were never asleep at all, because N1 sits so close to the wake threshold that subjective sleep perception frequently disagrees with the objective EEG-based scoring.

Slow rolling eye movements and hypnic phenomena

Simultaneous with alpha dropout, the EOG channels typically show slow, rolling, conjugate eye movements — smooth pendular deflections lasting several seconds, quite distinct from the rapid saccadic movements of wakefulness or the sharp bursts of REM sleep. These slow eye movements (SEMs) are a supportive, though not individually sufficient, marker of the wake-to-sleep transition, and they may persist into the early portion of N1 and occasionally N2.

Chin EMG tone typically shows a modest decline from its waking baseline as N1 begins, though the drop is gradual rather than the near-total atonia seen later in REM. Some individuals experience hypnic jerks — sudden, brief myoclonic contractions accompanied by a sensation of falling — as the motor system relaxes into sleep; these are benign and extremely common, occurring in the majority of the population at least occasionally.

Vertex sharp waves and the boundary with N2

As N1 deepens, vertex sharp waves may appear — sharply contoured, negative-polarity waveforms maximal over the central (Cz) region, distinct from alpha and lasting less than 0.5 seconds. Isolated vertex waves do not upgrade an epoch to N2; that transition requires the appearance of sleep spindles or K-complexes, the defining graphoelements of stage N2 described in the next stage.

Sleep-onset latency — the time from lights-out to the first epoch scored as any sleep stage (conventionally the first N1 epoch) — is a key clinical metric abstracted from this transition. Normal latency in healthy adults is roughly 10-20 minutes; markedly shortened latency (under 5 minutes) can indicate sleep deprivation or narcolepsy, while markedly prolonged latency (over 30 minutes) is characteristic of insomnia disorder or an unfamiliar sleep-lab environment (the well-documented "first-night effect").

Arousal fragmentation at the wake-sleep boundary

The wake-to-N1 transition is rarely a single clean crossing; most people drift back and forth across the threshold several times before achieving sustained sleep, briefly re-showing alpha rhythm or a body movement before settling again — each such reversal restarts the N1 clock and delays the point at which the hypnogram registers "stable" sleep onset. Patients with insomnia or heightened pre-sleep anxiety often generate an unusually long and fragmented run of alternating wake and N1 epochs, visible on the hypnogram as a ragged, indecisive opening band before the trace settles into deeper stages.

The Arousal Index slider in this simulator models exactly this effect at every later stage of the night as well: raising it increases the deterministic probability that any given epoch — even one deep into an N2 or REM period — reverts to a brief Wake scoring, mimicking the epoch-level fragmentation produced clinically by sleep apnea, periodic limb movements, pain, or environmental disturbance.

N2 Light Sleep — Spindles, K-Complexes, and the Bulk of the Night

Stage N2 occupies more of a typical night than any other sleep stage, and its identification rests on recognizing two hallmark EEG graphoelements — sleep spindles and K-complexes — against a backdrop of otherwise low-amplitude, relatively featureless background activity. Correctly distinguishing genuine spindles and K-complexes from artifact and from the deeper delta waves of N3 is one of the core technical skills of manual PSG scoring.

  • 11-16 Hz: Sleep spindle frequency (sigma band, typically 12-14 Hz)
  • 0.5-1.5 s: Spindle duration (waxing-waning envelope)
  • ≥0.5 s: K-complex minimum duration (sharp negative + positive deflection)
  • 45-55%: N2 share of total sleep time (largest single stage of the night)

Sleep spindles — thalamocortical gatekeepers

Sleep spindles are generated by rhythmic bursting in the thalamic reticular nucleus, projected onto the cortex through thalamocortical loops, producing a distinctive waxing-and-waning burst of 11-16 Hz (sigma band) activity lasting 0.5 to 1.5 seconds, most prominent over central derivations (C3/C4). A single spindle in an epoch, in the absence of any preceding K-complex or spindle from N1, is sufficient to score that epoch — and typically several subsequent epochs — as N2.

Spindles are thought to function as a sensory gate, suppressing the thalamic relay of external sensory information to the cortex and thereby helping to maintain sleep continuity in the face of ambient noise; spindle density and morphology also correlate with overnight procedural and declarative memory consolidation, and reduced spindle activity has been reported in schizophrenia and some neurodegenerative conditions, making spindle counting a research biomarker as well as a clinical scoring task.

K-complexes — the brain's response to a changing world

The K-complex is a high-amplitude biphasic waveform: a well-delineated negative sharp deflection immediately followed by a positive component, standing out clearly from the background EEG and lasting at least 0.5 seconds, maximal over the frontal derivations. K-complexes can occur spontaneously, reflecting ongoing sleep-maintenance processes, or can be evoked by external stimuli (a sound, a touch, a light) without necessarily producing a behavioral arousal — a phenomenon that led early sleep researchers to describe the K-complex as evidence that the sleeping brain continues to monitor and evaluate the environment even while behaviorally unresponsive.

An epoch containing a K-complex not associated with arousal, occurring in an epoch that does not otherwise meet the criteria for N3, is scored N2 — one spontaneous K-complex is enough to define the epoch, exactly as with a single sleep spindle.

A K-complex evoked by an ambient noise, such as a door closing down the hall, without any visible arousal or awakening in the EEG is direct electrophysiological evidence that the sleeping cortex continues to process and evaluate external stimuli — sleep is not simple sensory shutdown but an actively regulated, environmentally responsive state.

N2 continuation rules and its place in the sleep cycle

Once N2 has been established, the AASM manual allows subsequent epochs to continue being scored N2 even without a new spindle or K-complex in every single epoch, as long as there is no arousal, no alpha rhythm reappearance meeting N1 criteria, and no transition to N3 or REM — this "continuation rule" prevents the hypnogram from artificially fragmenting into brief false-N1 epochs whenever a quiet stretch of N2 happens to lack a discrete graphoelement.

Across a normal 90-110 minute sleep cycle, N2 typically forms the transitional stage both descending from N1 into N3 and ascending from N3 back toward REM, meaning a night's hypnogram usually shows N2 appearing repeatedly between every deep-sleep and REM period — which is why, cumulatively, N2 consumes roughly half of all recorded sleep time in a healthy adult.

AASM sleep stage scoring criteria

ProductIndicationTrial DesignKey Result
Wake (W)
N1
N2
N3
REM

N3 Slow-Wave Sleep — the Deepest, Most Restorative Stage

Stage N3, formerly split into "stage 3" and "stage 4" under the older Rechtschaffen and Kales system and merged into a single slow-wave sleep (SWS) category by the AASM in 2007, is defined by the dominance of high-amplitude, low-frequency delta waves. N3 carries the highest arousal threshold of any sleep stage, is concentrated in the first third of the night, and is the stage most tightly linked to physical restoration, including the night's largest pulse of growth hormone secretion.

  • 0.5-2 Hz: Delta wave frequency (slow-wave / delta band)
  • >75 µV: Minimum delta amplitude (peak-to-peak, frontal derivation)
  • ≥20%: N3 scoring threshold (of epoch occupied by delta)
  • ~20% → <5%: N3 in young adults vs. age 65+ (steep age-related decline)

The amplitude-frequency criterion

N3 is scored when 20% or more of a 30-second epoch consists of slow-wave activity: high-amplitude (greater than 75 µV peak-to-peak, measured frontally), low-frequency (0.5-2 Hz) delta waves. Unlike the qualitative pattern-recognition tasks of identifying spindles or K-complexes, N3 scoring is fundamentally quantitative — a scorer (or automated algorithm) must estimate what fraction of the 30-second window meets both the amplitude and frequency thresholds simultaneously, then compare that fraction against the 20% cutoff.

This quantitative delta-percentage rule is also the basis of "delta power," a continuous metric used in sleep research and increasingly in home sleep-tracking devices as a proxy for sleep depth and homeostatic sleep pressure, independent of the discrete stage label assigned to any given epoch.

The homeostatic sleep drive and first-third concentration

N3 is powerfully governed by homeostatic sleep pressure — the drive that accumulates during preceding wakefulness and is thought to be tracked, at least in part, by rising extracellular adenosine. This is why N3 is heavily concentrated in the first two or three sleep cycles of the night: a person who has been awake for 16 hours before lights-out enters their first sleep cycle with maximal homeostatic pressure, producing the longest and deepest N3 bout of the night, after which subsequent cycles show progressively shorter N3 periods (a pattern directly reflected in the hypnogram's stage-vs-time architecture) as REM periods correspondingly lengthen toward morning.

Selective N3 (slow-wave) sleep deprivation — waking a subject specifically whenever they enter N3, while allowing normal amounts of other stages — produces a pronounced compensatory rebound of N3 on subsequent recovery nights, demonstrating that slow-wave sleep is homeostatically regulated with the same rigor as total sleep time itself.

N3 has the highest arousal threshold of any sleep stage — loud noises, or even direct physical stimulation, that would readily wake someone from N1 or N2 often fail to rouse a person from deep N3, which is also when confusional arousals, sleepwalking, and sleep terrors (the NREM parasomnias) most commonly originate, precisely because the brain is only partially responsive as it is abruptly pulled toward wakefulness.

Growth hormone, tissue repair, and glymphatic clearance

Roughly 70% of a person's daily growth hormone (GH) secretion occurs in a single large pulse tightly coupled to the first N3 period of the night, driven by hypothalamic growth-hormone-releasing hormone (GHRH) release that is itself entrained to slow-wave sleep onset. This GH pulse supports protein synthesis, tissue repair, and — in children and adolescents — linear bone growth, which is part of why adequate deep sleep is considered especially critical during development.

N3 is also the period during which the glymphatic system — the brain's cerebrospinal-fluid-based waste clearance network — is thought to be maximally active, with interstitial space expanding and clearance of metabolic byproducts including amyloid-beta increasing substantially compared to wakefulness, a finding that has driven considerable research interest into the relationship between chronic slow-wave sleep loss and long-term neurodegenerative disease risk. N3 declines steeply and steadily across the adult lifespan, from roughly 15-20% of total sleep time in healthy young adults to well under 5% by the seventh and eighth decades — one of the most consistent and reproducible findings in sleep medicine.

Scoring N3 amid movement artifact and NREM parasomnias

Distinguishing genuine delta activity from movement or electrode artifact is one of the more error-prone aspects of manual N3 scoring, because both can produce large-amplitude deflections on the EEG trace; scorers cross-reference the EMG and video channels (nearly all clinical labs synchronize infrared video with the PSG) to confirm that a high-amplitude waveform reflects true cortical slow-wave activity rather than a body shift, cable tug, or electrode pop.

Because N3 carries the highest arousal threshold of the night, confusional arousals, sleepwalking, sleep talking, and sleep terrors — collectively the disorders of arousal — characteristically emerge from N3 in the first third of the night rather than from lighter NREM stages or REM, reflecting the difficulty of cleanly transitioning a deeply suppressed cortex to full wakefulness. Video-PSG is considered essential whenever a parasomnia is suspected clinically, since the EEG and EMG record alone can look ambiguous while synchronized video unambiguously captures the behavioral event.

REM Sleep and the Completed Hypnogram

REM (rapid eye movement) sleep is the stage most tightly associated with vivid dreaming, characterized by a striking physiological paradox: an EEG pattern resembling light sleep or even wakefulness, paired with near-total paralysis of the skeletal musculature. Assembled across an entire night, the alternation of REM with the NREM stages produces the hypnogram — the single chart that summarizes 960 individually scored epochs into the recognizable architecture of a night's sleep.

  • 20-25%: REM share of total sleep time (in healthy adults)
  • 90-110 min: Typical sleep cycle length (one NREM-REM cycle)
  • 4-6: Cycles per 8-hour night (REM lengthens toward morning)
  • Lowest of night: REM chin EMG amplitude (glycinergic/GABAergic atonia)

The three defining signs of REM

REM sleep is scored when three signal features converge: (1) low-amplitude, mixed-frequency EEG, often including a distinctive "sawtooth" wave pattern — notched, triangular 2-6 Hz waves maximal over central derivations, frequently clustering just before or during a burst of eye movements; (2) episodic bursts of rapid, sharp, irregular conjugate eye movements on EOG, quite different from the slow rolling movements of N1 or the near-total quiescence of N2/N3; and (3) chin EMG tone at or near the lowest level recorded anywhere in the study — often flat except for brief phasic twitches.

Because the low-voltage mixed-frequency EEG of REM can superficially resemble N1, the chin EMG atonia is often the decisive discriminator: an epoch with N1-like EEG but persistent low tone and eye-movement bursts is scored REM, not N1. First REM sleep of the night typically appears 70-100 minutes after sleep onset (REM latency); markedly shortened REM latency, under about 15 minutes, is a hallmark finding in narcolepsy and in some cases of major depression.

REM atonia — a brainstem-orchestrated paralysis

The skeletal muscle atonia of REM is actively generated, not merely a passive relaxation: neurons in the sublaterodorsal nucleus (SLD) of the pons project to glycinergic and GABAergic premotor neurons in the medulla and spinal ventral horn, which in turn hyperpolarize spinal motor neurons and block their response to descending motor commands — effectively disconnecting the brain's motor cortex from the muscles it would otherwise drive, even as the brain generates the same complex motor "commands" it would during a waking dream-equivalent action.

When this atonia circuit fails — as in REM sleep behavior disorder (RBD) — patients physically act out their dreams, sometimes violently, and the disorder carries substantial clinical importance because it is one of the strongest known prodromal markers of future alpha-synucleinopathy neurodegenerative disease (Parkinson disease, dementia with Lewy bodies, or multiple system atrophy), often preceding motor diagnosis by a decade or more.

Roughly 80% of people awakened from REM sleep report vivid, narrative dreaming, compared to only about 20% awakened from NREM stages — yet the EMG atonia that defines REM sleep is precisely what prevents a dreamer from physically enacting the dream, a fail-safe whose breakdown in REM sleep behavior disorder offers one of the clearest windows we have into the neurobiology linking dreaming and movement.

Assembling the hypnogram across the night

A completed hypnogram plots the scored stage of every one of the night's 960 epochs against time, conventionally with wake and REM near the top and progressively deeper NREM stages (N1, N2, N3) descending below — producing the familiar sawtoothed staircase pattern that sleep physicians read at a glance. In a healthy adult, the pattern shows 4-6 discrete cycles of roughly 90-110 minutes each: N3 is deepest and longest in the first one to two cycles, then progressively shortens and may disappear entirely from later cycles, while REM periods start brief (a few minutes) in the first cycle and lengthen substantially — sometimes to 30-40 minutes — by the final cycle before natural waking.

From the hypnogram, clinicians derive the summary metrics that anchor a PSG report: total sleep time (TST), sleep efficiency (TST divided by total time in bed, expressed as a percentage — a value below about 85% is often considered reduced), wake after sleep onset (WASO), REM latency, and the percentage of total sleep time occupied by each stage — all of which feed into the diagnosis of insomnia, sleep apnea, narcolepsy, and dozens of other sleep and circadian disorders. The Arousal Index, tracked separately, counts EEG-defined cortical arousals per hour of sleep; a high arousal index — often driven by repetitive respiratory events, periodic limb movements, or pain — fragments every stage shown here, shortening and interrupting N3 and REM periods and directly degrading the restorative value of the night even when total sleep time looks superficially adequate.

Automated scoring and inter-scorer agreement

Even among trained, AASM-credentialed technologists, manual epoch-by-epoch stage scoring shows only moderate inter-rater agreement — published studies typically report roughly 80-85% overall epoch-level agreement between independent scorers on the same recording, with the lowest agreement clustered around the N1-N2 and N2-N3 boundaries, exactly the transitions that depend on judgment calls about graphoelement amplitude and percentage-of-epoch thresholds rather than unambiguous binary criteria.

This variability has motivated a large and active body of machine-learning research aimed at automated hypnogram generation directly from raw EEG/EOG/EMG signals, with modern convolutional and recurrent neural network classifiers now approaching or matching average human-scorer agreement on standard research datasets. Clinically, however, automated stage output is still generally treated as a decision-support draft: a credentialed scorer reviews and can override every epoch before a polysomnography report is finalized, in part because automated classifiers are typically trained on healthy or moderately disordered sleep and can degrade on unusual or severely fragmented recordings — exactly the patients for whom an accurate hypnogram matters most.

⚙ Under the hood

This simulation allows users to practice scoring sleep stages based on polysomnography data. It provides a detailed interface for identifying and categorizing various physiological parameters during different phases of sleep.

CanvasBiomedicine

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)