Skip to content

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

Closed

Description

@scott-huberty

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?

Activity

  1. larsoner commented on Jan 23, 2024

    @larsoner
    Member

    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

  2. scott-huberty commented on Jan 23, 2024

    @scott-huberty
    ContributorAuthor

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

  3. hoechenberger commented on Jan 24, 2024

    @hoechenberger
    Member

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

  4. Famous077 commented on Feb 23, 2026

    @Famous077
    Contributor

    Hi @scott-huberty , I’d like to work on this documentation improvement. I can add clear API docs for the onset, duration, and description attributes of Annotations, along with a short example showing how to access them. Could you please assign this issue to me?

  5. tsbinns commented on Feb 23, 2026

    @tsbinns
    Member

    @Famous077 Thanks for wanting to contribute. We don't typically assign issues to users. Just feel free to open a PR whenever you have something.

  6. Famous077 commented on Feb 24, 2026

    @Famous077
    Contributor

    @tsbinns Thanks for the clarification. I've already implemented the fix and
    raised a PR. Happy to update based on your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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