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

Function test_sorting

mne/tests/test_annotations.py:1360–1376  ·  view source on GitHub ↗

Test annotation sorting.

()

Source from the content-addressed store, hash-verified

1358
1359
1360def test_sorting():
1361 """Test annotation sorting."""
1362 annot = Annotations([10, 20, 30], [1, 2, 3], "BAD")
1363 # assert_array_equal(annot.onset, [0, 5, 10])
1364 annot.append([5, 15, 25, 35], 0.5, "BAD")
1365 onset = list(range(5, 36, 5))
1366 duration = list(annot.duration)
1367 assert_array_equal(annot.onset, onset)
1368 assert_array_equal(annot.duration, duration)
1369 annot.append([10, 10], [0.1, 9], "BAD") # 0.1 should be before, 9 after
1370 want_before = onset.index(10)
1371 duration.insert(want_before, 0.1)
1372 duration.insert(want_before + 2, 9)
1373 onset.insert(want_before, 10)
1374 onset.insert(want_before, 10)
1375 assert_array_equal(annot.onset, onset)
1376 assert_array_equal(annot.duration, duration)
1377
1378
1379def test_date_none(tmp_path):

Callers

nothing calls this directly

Calls 3

appendMethod · 0.95
AnnotationsClass · 0.90
insertMethod · 0.80

Tested by

no test coverage detected