MCPcopy
hub / github.com/mne-tools/mne-python / _write_annotations

Function _write_annotations

mne/annotations.py:1712–1734  ·  view source on GitHub ↗

Write annotations.

(fid, annotations)

Source from the content-addressed store, hash-verified

1710
1711
1712def _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
1737def _write_annotations_csv(fname, annot):

Callers 3

_save_partFunction · 0.85
saveMethod · 0.85
_write_raw_metadataFunction · 0.85

Calls 8

start_blockFunction · 0.85
write_floatFunction · 0.85
write_doubleFunction · 0.85
_dt_to_stampFunction · 0.85
write_stringFunction · 0.85
end_blockFunction · 0.85
_any_ch_namesMethod · 0.80

Tested by

no test coverage detected