mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

Missing documentation for onset, duration, description attributes in Annotations class?

Open scott-huberty opened this issue 2 years ago • 3 comments

Proposed documentation enhancement

A colleague of mine who is a bit of an MNE power user had no idea that you can do something like raw.annotations.onset to retrieve an array of the onsets of all individual annotations:

import mne

annot = mne.Annotations(onset=[1, 3, 5], duration=[1, 1, 1], description=['a', 'b', 'c'])
annot.onset 
# array([1., 3., 5.])

As far as I can tell we don't document the onset, duration, description attributes in the API documentation. Should we?

scott-huberty avatar Jan 22 '24 21:01 scott-huberty

Yeah we could add them. I think we get them for free (maybe?) if we do:

def __init__(self, ...)
    ...
    self._onset, self._duration, ... = ...

@property
def onset(self):
    """..."""
    return self._onset

@onset.setter
def onset(self, onset)
    self._onset[:] = onset

Or something like this

larsoner avatar Jan 23 '24 01:01 larsoner

Ok I'll test it out and open a PR when I have some time.

scott-huberty avatar Jan 23 '24 21:01 scott-huberty

(Still thinking these should all be pluralized but this is a different discussion I suppose)

hoechenberger avatar Jan 24 '24 11:01 hoechenberger