yasa.Hypnogram.to_json#
- Hypnogram.to_json(fname)[source]#
Save the Hypnogram to a JSON file.
The file can be reloaded with
from_json. All metadata is preserved: epoch duration, start datetime (including timezone), scorer name, and stage probabilities. Stage probabilities (proba) are rounded to 6 decimal places.This method delegates to
to_dictfor serialization.Added in version 0.7.0.
- Parameters:
- fnamestr or path-like
Output file path. By convention, use a
.jsonextension.