mne.Annotations

class mne.Annotations(onset, duration, description, orig_time=None)

Annotation object for annotating segments of raw data.

Annotations are added to instance of mne.io.Raw as an attribute named annotations. See the example below. To reject bad epochs using annotations, use annotation description starting with ‘bad’ keyword. The epochs with overlapping bad segments are then rejected automatically by default.

To remove epochs with blinks you can do::
>>> eog_events = mne.preprocessing.find_eog_events(raw)  
>>> n_blinks = len(eog_events)  
>>> onset = eog_events[:, 0] / raw.info['sfreq'] - 0.25  
>>> duration = np.repeat(0.5, n_blinks)  
>>> description = ['bad blink'] * n_blinks  
>>> annotations = mne.Annotations(onset, duration, description)  
>>> raw.annotations = annotations  
>>> epochs = mne.Epochs(raw, events, event_id, tmin, tmax)  
Parameters:

onset : array of float, shape (n_annotations,)

Annotation time onsets from the beginning of the recording in seconds.

duration : array of float, shape (n_annotations,)

Durations of the annotations in seconds.

description : array of str, shape (n_annotations,) | str

Array of strings containing description for each annotation. If a string, all the annotations are given the same description. To reject epochs, use description starting with keyword ‘bad’. See example above.

orig_time : float | int | instance of datetime | array of int | None

A POSIX Timestamp, datetime or an array containing the timestamp as the first element and microseconds as the second element. Determines the starting time of annotation acquisition. If None (default), starting time is determined from beginning of raw data acquisition. In general, raw.info['meas_date'] (or None) can be used for syncing the annotations with raw data if their acquisiton is started at the same time.

Notes

If orig_time is None, the annotations are synced to the start of the data (0 seconds). Otherwise the annotations are synced to sample 0 and raw.first_samp is taken into account the same way as with events.

Methods

__hash__() <==> hash(x)
__hash__() <==> hash(x)