Create the peak of flat annotations from the any_arr.
(any_arr, kind, raw)
| 264 | |
| 265 | |
| 266 | def _create_annotations(any_arr, kind, raw): |
| 267 | """Create the peak of flat annotations from the any_arr.""" |
| 268 | assert kind in ("peak", "flat") |
| 269 | starts, stops = _mask_to_onsets_offsets(any_arr) |
| 270 | starts, stops = np.array(starts), np.array(stops) |
| 271 | onsets = starts / raw.info["sfreq"] |
| 272 | durations = (stops - starts) / raw.info["sfreq"] |
| 273 | annot = Annotations( |
| 274 | onsets, |
| 275 | durations, |
| 276 | [f"BAD_{kind}"] * len(onsets), |
| 277 | orig_time=raw.info["meas_date"], |
| 278 | ) |
| 279 | _adjust_onset_meas_date(annot, raw) |
| 280 | return annot |
no test coverage detected