Assert that there are boundary annotations and remove them.
(annotations, n=1)
| 168 | |
| 169 | |
| 170 | def assert_and_remove_boundary_annot(annotations, n=1): |
| 171 | """Assert that there are boundary annotations and remove them.""" |
| 172 | __tracebackhide__ = True |
| 173 | |
| 174 | from ..io import BaseRaw |
| 175 | |
| 176 | if isinstance(annotations, BaseRaw): # allow either input |
| 177 | annotations = annotations.annotations |
| 178 | for key in ("EDGE", "BAD"): |
| 179 | idx = np.where(annotations.description == f"{key} boundary")[0] |
| 180 | assert len(idx) == n, ( |
| 181 | f"Got {len(idx)} '{key} boundary' annotations, expected {n}" |
| 182 | ) |
| 183 | annotations.delete(idx) |
| 184 | |
| 185 | |
| 186 | def assert_object_equal(a, b, *, err_msg="Object mismatch", allclose=False): |
no test coverage detected