Write annotations.
(fid, annotations)
| 1710 | |
| 1711 | |
| 1712 | def _write_annotations(fid, annotations): |
| 1713 | """Write annotations.""" |
| 1714 | start_block(fid, FIFF.FIFFB_MNE_ANNOTATIONS) |
| 1715 | write_float(fid, FIFF.FIFF_MNE_BASELINE_MIN, annotations.onset) |
| 1716 | write_float( |
| 1717 | fid, FIFF.FIFF_MNE_BASELINE_MAX, annotations.duration + annotations.onset |
| 1718 | ) |
| 1719 | write_name_list_sanitized( |
| 1720 | fid, FIFF.FIFF_COMMENT, annotations.description, name="description" |
| 1721 | ) |
| 1722 | if annotations.orig_time is not None: |
| 1723 | write_double(fid, FIFF.FIFF_MEAS_DATE, _dt_to_stamp(annotations.orig_time)) |
| 1724 | if annotations._any_ch_names(): |
| 1725 | write_string( |
| 1726 | fid, FIFF.FIFF_MNE_EPOCHS_DROP_LOG, json.dumps(tuple(annotations.ch_names)) |
| 1727 | ) |
| 1728 | if any(d is not None for d in annotations.extras): |
| 1729 | write_string( |
| 1730 | fid, |
| 1731 | FIFF.FIFF_FREE_LIST, |
| 1732 | json.dumps([extra.data for extra in annotations.extras]), |
| 1733 | ) |
| 1734 | end_block(fid, FIFF.FIFFB_MNE_ANNOTATIONS) |
| 1735 | |
| 1736 | |
| 1737 | def _write_annotations_csv(fname, annot): |
no test coverage detected