MCPcopy Index your code
hub / github.com/mne-tools/mne-python / _create_annotations

Function _create_annotations

mne/preprocessing/_annotate_amplitude.py:266–280  ·  view source on GitHub ↗

Create the peak of flat annotations from the any_arr.

(any_arr, kind, raw)

Source from the content-addressed store, hash-verified

264
265
266def _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

Callers 1

annotate_amplitudeFunction · 0.85

Calls 3

_mask_to_onsets_offsetsFunction · 0.85
AnnotationsClass · 0.85
_adjust_onset_meas_dateFunction · 0.85

Tested by

no test coverage detected