Skip to content

DOC: document onset, duration, description, and ch_names attributes of mne.Annotations#13680

Open
Famous077 wants to merge 10 commits intomne-tools:mainfrom
Famous077:doc/annotations-onset-duration-description
Open

DOC: document onset, duration, description, and ch_names attributes of mne.Annotations#13680
Famous077 wants to merge 10 commits intomne-tools:mainfrom
Famous077:doc/annotations-onset-duration-description

Conversation

@Famous077
Copy link

@Famous077 Famous077 commented Feb 24, 2026

What does this implement/fix?

--> I have Converted onset, duration, description, and ch_names from plain
instance attributes to documented properties in mne/annotations.py,
so they appear in the API reference with proper NumPy-style docstrings.

Additional information

--> Even experienced MNE users were unaware these attributes existed because
they did not appear in the generated API documentation. A changelog entry
has been added in doc/changes/dev/12379.other.rst.

@scott-huberty
Copy link
Contributor

@Famous077 can you please sign in to CircleCI via the sign in with Github option? After you do this and push a commit to this branch, the build docs job should run.

Comment on lines 434 to 436
@onset.setter
def onset(self, onset):
self._onset = onset
Copy link
Contributor

@scott-huberty scott-huberty Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, whether intentionally or by oversight, we left these onset/duration/description attributes free to be mutated without any guardrails.. I myself have taken advantage of this! But now that they are properties and documented on our website, should we do some minimal validation in the setter? For example, checking that a newly set onset array has the same length as the durations, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scott-huberty . Thank you for the clarification. I'll add basic validation to the setters ,checking length
consistency and proper dtype.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scott-huberty Added basic validation to the onset, duration, and description setters
to check length consistency and proper dtype conversion. Please let me
know if any further changes are needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @scott-huberty , Would appreciate your review when you get a chance. Happy to update based on your feedback. Thank you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Famous077 please stand by, I plan to discuss this with folks during the office hours on Friday.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scott-huberty Thanks for the update. I’ll stand by and look forward to the discussion on Friday.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants