yasa.Hypnogram.from_dict#

classmethod Hypnogram.from_dict(d)[source]#

Reconstruct a Hypnogram from a dictionary produced by to_dict.

All metadata is restored: epoch duration, start datetime (including timezone), scorer name, and stage probabilities (if present).

Added in version 0.7.0.

Parameters:
ddict

A dictionary with keys "values", "n_stages", "freq", "start", "scorer", and "proba", as returned by to_dict.

Returns:
hypHypnogram

The reconstructed Hypnogram.

See also

to_dict

Return the Hypnogram as a JSON-serializable dictionary.

from_json

Load a Hypnogram from a JSON file on disk.