Skip to content

Getting started

Installation

Somnio requires Python 3.10+.

With uv

uv add somnio

To use the CLI, install with the optional cli extra:

uv add somnio --extra cli

The download-nsrr command also needs the nsrr extra:

uv add somnio --extra cli --extra nsrr

Extras matrix

Somnio ships small optional extras so you can install only what you use:

  • cli: command-line interface
  • nsrr: NSRR download helpers
  • schemas: pipeline YAML schemas
  • signal: SciPy-based signal processing
  • mne: MNE-based processing
  • edf: EDF I/O
  • hdf5: HDF5 layouts
  • onnx: ONNX Runtime sleep scoring backends; see Sleep scoring
  • tensorflow: TensorFlow sleep scoring backends; see Sleep scoring
  • eeg-usability: EEG usability scoring from eegFloss lite models; see EEG usability

With pip

pip install somnio

For CLI support:

pip install somnio[cli]

For download-nsrr:

pip install 'somnio[cli,nsrr]'

For SciPy-based signal processing (resample, and other SciPy transforms):

pip install somnio[signal]

For MNE-based filtering (apply_filter) and the MNE ↔ TimeSeries adapter:

pip install somnio[mne]

Eye-movement detection with default preprocessing needs both:

pip install 'somnio[signal,mne]'

For HDF5 signal layouts (somnio.io.hdf5, native and USleep formats):

uv add somnio --extra hdf5
# or
pip install somnio[hdf5]

Verify installation

If you installed the CLI extra, confirm it works:

somnio --help

You should see the list of commands (e.g. download-nsrr).