[WIP [ENH] metadata attribute for Annotations#12213
[WIP [ENH] metadata attribute for Annotations#12213eioe wants to merge 7 commits intomne-tools:mainfrom
Conversation
for more information, see https://pre-commit.ci
mne/annotations.py
Outdated
| metadata : dict | array-like | ||
| Metadata for the annotation. Can be a dict or an array-like | ||
| object of dicts. If an array-like object, must be the same length | ||
| as ``onset``. |
There was a problem hiding this comment.
with this we'd be exposing metadata to the user --> weren't we discussing keeping it private, and having dedicated functions populate / add / use / change this data?
If we make it public here (exposing it in the docstring), then I think we might as well make it completely public 🤔
There was a problem hiding this comment.
with this we'd be exposing
metadatato the user --> weren't we discussing keeping it private, and having dedicated functions populate / add / use / change this data?If we make it public here (exposing it in the docstring), then I think we might as well make it completely public 🤔
good point. That's inconsistent. We can also not allow to append Annotations with metadata manually. And behind the scenes then just do:
self._metadata = np.append(self._metadata, {})
I haven't checked, yet, whether .append() is used somewhere in code, though.
|
update: just had a chat with @drammock and @britta-wstnr , and it looks like we'll approach this in a fundamentally different way. So please no one spend too much time with reading & commenting what will be outdated soon. |
…ioe/mne-python into feat/issue-12208/annotmetadata
for more information, see https://pre-commit.ci
| # We need this, bc if we create Annotations from events which are not sorted, | ||
| # and we then directly query for the according IDs, we cannot do this simply by | ||
| # index as the Annotations will already on creation be sorted. | ||
| def _get_id(self, onset, duration, description): |
There was a problem hiding this comment.
I'm afraid that this is far from optimal and might be slow once there are many annotations.
|
closed by #13228 . |
Supposed to fix #12208 .
I want to add a private property
_metadatatomne.annotations.Annotationswhich stores a (list of)dict()that can be used to pass along additional data with an annotation (for example, eye tracking realted info).[ This is WIP. Just started this PR to check back whether this goes into the right direction before I refactor the whole class. ]