Skip to content

ENH: make use of time-stamps optional in mne.Annotations.to_data_frame() #12274

@dengemann

Description

@dengemann

Describe the new feature or enhancement

Hi folks!

I find the .to_data_frame() method for annotations very practical but I realize that the default behavior of having onsets in timestamps is not always what is practical from a perspective of data analysis where you might want to keep selecting data based on times in seconds (float).

I was wondering how you would feel about including an enhancment that would make following snippet of code work:

annot = mne.Annotations(onset=[0, 10, 20], duration=[2] * 3, description='test')
annot_df = annot.to_data_frame(self, onset_as_time_stamp=False)
assert annot_df['onset'] == annot.onset

Describe your proposed implementation

I would make conversion to time-stamps optional.

Describe possible alternatives

I cannot think of another implementation. One can of course post-hoc edit the data frame but the point of a convenience method is to be convenient.

Additional context

This can be helpful when analyzing continuous data in a fashion that does not involve epoching, e. g., in richly annotated long-term EEG recordings.

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