Tutorials

How to view a sleep study (PSG) EDF file

Open the signals, page through in 30-second epochs, and find the sleep stages.

5 min readUpdated December 2026

What a sleep study holds

A polysomnogram (PSG) records a whole night, and its EDF file holds more than EEG. Each kind of channel is often recorded at its own rate, which EDF allows: fast for EEG and muscle, slow for breathing and oxygen.

Channels a sleep study usually holds
ChannelWhat it records
EEG, such as F4-M1, C4-M1 and O2-M1Brain activity, the basis of sleep stages
EOG, left and rightEye movements, which mark REM sleep
Chin EMGMuscle tone, which falls in REM sleep
ECGThe heart
Leg EMGLeg movements
Airflow and effortBreathing at the nose and mouth, and the movement of the chest and abdomen
SpO2Oxygen saturation, in %

Open a night in your browser

PhysioNet’s Sleep-EDF Database Expanded is free to download: 197 whole nights, each a PSG file in EDF with a hypnogram file beside it. SC4001E0-PSG.edf, 48 MB, has two EEG channels and one EOG channel at 100 Hz, and breathing, chin muscle, temperature and an event marker at 1 Hz.

  1. Drop the PSG file on the Online EEG Reviewer. Each channel is drawn at its own rate; channels without a voltage unit, such as breathing or temperature, are drawn by their shape. Choose Auto-fit under the scale to size each channel to its own signal; temperature barely changes within a page, so it stays flat.

    Online EEG Reviewer: the first 30 seconds of a sleep recording, SC4001E0

    Recording: PhysioNet Sleep-EDF Database Expanded, SC4001E0 (Kemp et al. 2000), ODC-By 1.0.

  2. Set Window to 30 s: sleep is scored in 30-second epochs, so each page is one epoch. Keep the montage on Original: sleep EEG is often stored as pairs already, such as Fpz-Cz or C4-M1.

  3. Page with ← and →, or type a time such as 8:30:30 to go there. A whole night is long: this one runs 22 hours, and sleep begins 8 hours 30 minutes after the start.

Free shows the first 10 minutes of each recording, so a night needs Pro or Max. The Reviewer and the app show the signals; they do not score sleep stages or detect events.

Where the sleep stages are

The scoring is usually a file of its own. Sleep-EDF keeps it in an EDF+ file with only annotations, such as SC4001EC-Hypnogram.edf, which marks runs of 30-second epochs as Sleep stage W, 1, 2, 3, 4, R or ? (not scored); other nights also mark Movement time. The Online EEG Reviewer opens each file in a tab of its own and needs signals to draw, so it cannot open the hypnogram or lay its stages over the PSG. The National Sleep Research Resource (NSRR) keeps its scoring in XML files beside each EDF.

In Python, MNE-Python reads the two Sleep-EDF files together:

import mne

raw = mne.io.read_raw_edf("SC4001E0-PSG.edf")
stages = mne.read_annotations("SC4001EC-Hypnogram.edf")
raw.set_annotations(stages)  # the stages as annotations on the signals
print(raw.annotations.description[:5], raw.annotations.onset[:5])

MNE-Python resamples every channel to the highest rate as it reads the file, so the 1 Hz channels come out at 100 Hz. It warns that one stage runs past the end of the recording, and cuts it there.

On iPhone, iPad and Mac

EEG TraceLab opens the same PSG files, each channel at its own rate. Name the recording when you import it, and the app keeps a de-identified copy, which suits clinical sleep files whose header holds a name or a date of birth.

Download on the App StoreDownload on the Mac App Store

Common problems

SpO2 or breathing has no spectrum

The spectrum is only for channels in a voltage unit, such as µV.

NSRR files need permission

NSRR data are free, but each dataset needs an account and an approved data access request. Its signals are EDF and open like any other.