Add an annotated segment. Operates inplace. Parameters ---------- onset : float | array-like Annotation time onset from the beginning of the recording in seconds. duration : float | array-like Duration of the annotation in seconds.
(
self, *, onset, duration, description, hed_string, ch_names=None, extras=None
)
| 1180 | |
| 1181 | @fill_doc |
| 1182 | def append( |
| 1183 | self, *, onset, duration, description, hed_string, ch_names=None, extras=None |
| 1184 | ): |
| 1185 | """Add an annotated segment. Operates inplace. |
| 1186 | |
| 1187 | Parameters |
| 1188 | ---------- |
| 1189 | onset : float | array-like |
| 1190 | Annotation time onset from the beginning of the recording in |
| 1191 | seconds. |
| 1192 | duration : float | array-like |
| 1193 | Duration of the annotation in seconds. |
| 1194 | description : str | array-like |
| 1195 | Description for the annotation. To reject epochs, use description |
| 1196 | starting with keyword 'bad'. |
| 1197 | hed_string : array of str, shape (n_annotations,) | str |
| 1198 | Sequence of strings containing a HED tag (or comma-separated list of HED |
| 1199 | tags) for each annotation. If a single string is provided, all annotations |
| 1200 | are assigned the same HED string. |
| 1201 | %(ch_names_annot)s |
| 1202 | extras : list[dict[str, int | float | str | None] | None] | None |
| 1203 | Optional list of dicts containing extras fields for each annotation. |
| 1204 | |
| 1205 | Returns |
| 1206 | ------- |
| 1207 | self : mne.HEDAnnotations |
| 1208 | The modified HEDAnnotations object. |
| 1209 | """ |
| 1210 | onset, duration, description, ch_names, extras = _check_o_d_s_c_e( |
| 1211 | onset, duration, description, ch_names, extras |
| 1212 | ) |
| 1213 | hed_string = self._check_hed_strings(hed_string, len(onset)) |
| 1214 | hed_objs = [ |
| 1215 | self.hed_string._validate_hed_string(v, self.hed_string._schema) |
| 1216 | for v in hed_string |
| 1217 | ] |
| 1218 | self.hed_string.extend([hs.get_original_hed_string() for hs in hed_objs]) |
| 1219 | self.hed_string._objs.extend(hed_objs) |
| 1220 | super().append( |
| 1221 | onset=onset, |
| 1222 | duration=duration, |
| 1223 | description=description, |
| 1224 | ch_names=ch_names, |
| 1225 | extras=extras, |
| 1226 | ) |
| 1227 | return self |
| 1228 | |
| 1229 | def __iadd__(self, other): |
| 1230 | """Add (concatenate) two HEDAnnotations objects in-place.""" |
no test coverage detected