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

Method delete

mne/annotations.py:594–612  ·  view source on GitHub ↗

Remove an annotation. Operates inplace. Parameters ---------- idx : int | array-like of int Index of the annotation to remove. Can be array-like to remove multiple indices.

(self, idx)

Source from the content-addressed store, hash-verified

592 return deepcopy(self)
593
594 def delete(self, idx):
595 """Remove an annotation. Operates inplace.
596
597 Parameters
598 ----------
599 idx : int | array-like of int
600 Index of the annotation to remove. Can be array-like to
601 remove multiple indices.
602 """
603 self.onset = np.delete(self.onset, idx)
604 self.duration = np.delete(self.duration, idx)
605 self.description = np.delete(self.description, idx)
606 self.ch_names = np.delete(self.ch_names, idx)
607 if isinstance(idx, int_like):
608 del self.extras[idx]
609 elif len(idx) > 0:
610 # convert slice-like idx to ints, and delete list items in reverse order
611 for i in np.sort(np.arange(len(self.extras))[idx])[::-1]:
612 del self.extras[i]
613
614 @fill_doc
615 def to_data_frame(self, time_format="datetime"):

Callers 15

_prune_ch_namesMethod · 0.95
_cortex_parcellationFunction · 0.45
_merge_eventsFunction · 0.45
_events_from_annotationsFunction · 0.45
_find_eventsFunction · 0.45
get_conditionMethod · 0.45
deleteMethod · 0.45
_create_infoFunction · 0.45

Calls

no outgoing calls

Tested by 7

test_annot_concat_cropFunction · 0.36
test_hed_annotationsFunction · 0.36
test_epoch_eqFunction · 0.36
test_concatenate_epochsFunction · 0.36