yasa.Hypnogram.from_profusion#

classmethod Hypnogram.from_profusion(fname, *, start=None, tz=None, scorer=None)[source]#

Create a Hypnogram from a Compumedics Profusion hypnogram (.xml).

The Compumedics Profusion hypnogram format is one of the two hypnogram formats found on the National Sleep Research Resource (NSRR) website. For details on the format, see nsrr/edf-editor-translator.

The epoch length and sleep stage integers are read directly from the XML file. Profusion integer stages are mapped to YASA conventions: stage 4 (S4/N3) → 3, stage 5 (REM) → 4.

Added in version 0.7.0.

Parameters:
fnamestr or path-like

Path to the Profusion XML file.

startstr, datetime, or pd.Timestamp, optional

Start datetime of the recording (e.g. "2022-12-15 22:30:00"). Can be combined with tz to localize a naive string to a specific timezone.

tzstr, optional

Timezone string to localize a naive start (e.g. "Europe/Paris"). See Hypnogram for details.

scorerstr, optional

Name of the scorer.

Returns:
hypHypnogram

A Hypnogram instance with string-encoded stages.

Examples

>>> from yasa import Hypnogram
>>> hyp = Hypnogram.from_profusion("path/to/hypnogram.xml")
>>> hyp = Hypnogram.from_profusion(
...     "path/to/hypnogram.xml",
...     start="2022-12-15 22:30:00",
...     tz="Europe/Paris",
... )