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

Function _assert_annotations_equal

mne/tests/test_annotations.py:973–990  ·  view source on GitHub ↗
(a, b, tol=0, comp_extras_as_str=False)

Source from the content-addressed store, hash-verified

971
972
973def _assert_annotations_equal(a, b, tol=0, comp_extras_as_str=False):
974 __tracebackhide__ = True
975 assert_allclose(a.onset, b.onset, rtol=0, atol=tol, err_msg="onset")
976 assert_allclose(a.duration, b.duration, rtol=0, atol=tol, err_msg="duration")
977 assert_array_equal(a.description, b.description, err_msg="description")
978 assert_array_equal(a.ch_names, b.ch_names, err_msg="ch_names")
979 a_orig_time = a.orig_time
980 b_orig_time = b.orig_time
981 assert a_orig_time == b_orig_time, "orig_time"
982 extras_columns = a._extras_columns.union(b._extras_columns)
983 for col in extras_columns:
984 for i, extra in enumerate(a.extras):
985 exa = extra.get(col, None)
986 exb = b.extras[i].get(col, None)
987 if comp_extras_as_str:
988 exa = str(exa) if exa is not None else ""
989 exb = str(exb) if exb is not None else ""
990 assert exa == exb, f"extras[{i}][{col}]"
991
992
993_ORIG_TIME = datetime.fromtimestamp(1038942071.7201, timezone.utc)

Calls

no outgoing calls

Tested by

no test coverage detected