Skip to content

Add metadata to Annotations #13199

Open
Open
@PierreGtch

Description

@PierreGtch

Describe the new feature or enhancement

The raw.annotations attribute holds information regarding the events happening in a row file.
However, this information is limited: we only have the onset, a string description and the duration of the events. For some tasks, other information could be useful to have; for example: response time, stimulation parameters, etc.

Moreover, the BIDS format supports arbitrary annotations of the events, but only the onset, description and duration can be saved in the mne.Annotations objects.

The mne.Epochs support arbitrary event information through the metadata attribute, but in the standard processing raw->epochs, the user has to handle the metadata on the side, then include it to the epochs.

Describe your proposed implementation

I propose to add a metadata attribute to the mne.Annotations class, with type None | pd.DataFrame.
When creating epochs, this new field should automatically populate the epochs.metadata attribute.

Describe possible alternatives

Possible alternative when doing a standard processing raw->epochs is to:

  • load the raw objects
  • load the additional event information on the side (metadata)
  • create the epochs
  • filter and reorder the metadata rows such they match the created epochs
  • set the epochs.metadata attribute

Additional context

This issue is related to mne-tools/mne-bids#1389

@drammock what do you think?

CC @matthiasdold

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions