Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0f70809
DOC: document onset, duration, description, ch_names attrs of Annotat…
Famous077 Feb 24, 2026
31c138e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2026
6cef5a6
DOC: trigger CircleCI build
Famous077 Feb 24, 2026
aa3c052
Merge branch 'doc/annotations-onset-duration-description' of https://…
Famous077 Feb 24, 2026
0de9d78
DOC: add validation to onset, duration, description setters
Famous077 Feb 24, 2026
9dab228
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Feb 24, 2026
bd5e6ab
DOC: remove length validation from setters to avoid internal conflicts
Famous077 Feb 25, 2026
161838f
Merge branch 'doc/annotations-onset-duration-description' of https://…
Famous077 Feb 25, 2026
1edf047
DOC: fix contributor name format in changelog
Famous077 Feb 25, 2026
34c420f
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Feb 27, 2026
2396495
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 5, 2026
5732911
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 5, 2026
5b59b56
DOC: fix changelog filename and add Famous077 to names.inc
Famous077 Mar 6, 2026
430e408
DOC: remove duplicate Famous Raj Bhat entry from names.inc
Famous077 Mar 6, 2026
74f44f6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 6, 2026
519c401
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 6, 2026
43adc6c
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 10, 2026
dd449ac
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 11, 2026
144bf1c
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 12, 2026
e80b4a4
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 12, 2026
05e6f66
DOC: fix setter validation for duration/description and fix contribut…
Famous077 Mar 19, 2026
a014f91
DOC: revert contributor name to Famous077 for consistency
Famous077 Mar 19, 2026
05ae8c3
Merge branch 'main' into doc/annotations-onset-duration-description
Famous077 Mar 19, 2026
b20ab9f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 19, 2026
58816a0
ENH: validate array lengths in onset/duration/description/ch_names se…
Famous077 Mar 19, 2026
a5aa6a0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 19, 2026
40ab2d2
FIX: use private attributes in HEDAnnotations __setstate__ to avoid s…
Famous077 Mar 19, 2026
9157d6d
DOC: add cross-reference hyperlinks in See Also sections and clarify …
Famous077 Mar 20, 2026
5db54f2
DOC: use :attr: cross-references in See Also sections of Annotations …
Famous077 Mar 21, 2026
eb45f5b
ENH: add length validation to _check_onset, fix description setter, m…
Famous077 Apr 4, 2026
dc2516d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2026
8b5a5dc
FIX: add length validation to _check_duration and restore hed_string …
Famous077 Apr 4, 2026
bae3b81
Validate ch_names length
cbrnr May 27, 2026
0900064
Use np.atleast_1d() for consistency
cbrnr May 27, 2026
324831c
Fix error message
cbrnr May 27, 2026
9aea4c6
Remove redundant check
cbrnr May 27, 2026
7f920a8
Add ch_names check
cbrnr May 27, 2026
d16152a
Merge branch 'main' into doc/annotations-onset-duration-description
larsoner May 28, 2026
ad52a37
Update mne/tests/test_annotations.py
cbrnr Jun 1, 2026
9110c36
DRY
scott-huberty Jun 2, 2026
73e8d3e
Merge remote-tracking branch 'refs/remotes/famous077/doc/annotations-…
scott-huberty Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/12379.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document :attr:`~mne.Annotations.onset`, :attr:`~mne.Annotations.duration`, :attr:`~mne.Annotations.description`, and :attr:`~mne.Annotations.ch_names` attributes of :class:`mne.Annotations`, by `Famous Raj Bhat`_.
76 changes: 75 additions & 1 deletion mne/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def __init__(
f"' '. Got: {orig_time}. Defaulting `orig_time` to None.",
RuntimeWarning,
)
self.onset, self.duration, self.description, self.ch_names, self._extras = (
self._onset, self._duration, self._description, self._ch_names, self._extras = (
_check_o_d_s_c_e(onset, duration, description, ch_names, extras)
)
self._sort() # ensure we're sorted
Expand All @@ -415,6 +415,80 @@ def orig_time(self):
"""The time base of the Annotations."""
return self._orig_time

@property
def onset(self):
"""Onset of each annotation (in seconds).

Returns
-------
onset : array of shape (n_annotations,)
The onset of each annotation in seconds from the start of
the recording.

See Also
--------
duration, description
Comment thread
Famous077 marked this conversation as resolved.
Outdated
"""
return self._onset

@onset.setter
def onset(self, onset):
self._onset = onset
Comment thread
drammock marked this conversation as resolved.

@property
def duration(self):
"""Duration of each annotation (in seconds).

Returns
-------
duration : array of shape (n_annotations,)
The duration of each annotation in seconds.

See Also
--------
onset, description
"""
return self._duration

@duration.setter
def duration(self, duration):
self._duration = duration
Comment thread
drammock marked this conversation as resolved.

@property
def description(self):
"""Description of each annotation.

Returns
-------
description : array of shape (n_annotations,)
A string description for each annotation (e.g., event
label or condition name).

See Also
--------
onset, duration
"""
return self._description

@description.setter
def description(self, description):
self._description = description
Comment thread
drammock marked this conversation as resolved.

@property
def ch_names(self):
"""Channel names associated with each annotation.

Returns
-------
ch_names : list of tuple
Channel names associated with each annotation.
"""
return self._ch_names

@ch_names.setter
def ch_names(self, ch_names):
self._ch_names = ch_names
Comment thread
drammock marked this conversation as resolved.

@property
def extras(self):
"""The extras of the Annotations.
Expand Down