Skip to content

ENH: return label and description fields from read_raw_egi#13967

Open
obergmartin wants to merge 2 commits into
mne-tools:mainfrom
obergmartin:main
Open

ENH: return label and description fields from read_raw_egi#13967
obergmartin wants to merge 2 commits into
mne-tools:mainfrom
obergmartin:main

Conversation

@obergmartin

@obergmartin obergmartin commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Reference issue

Fixes #10121

A resurrection!

What does this implement/fix?

This PR ensures that read_raw_egi() returns the label and description fields from EGI's Events_ECI TCP-IP 55513.xml file as a dictionary in the Annotations.extra field.

I wrote this code myself, no AI.

Additional information

I feel it's good to populate the Annotations.extra field directly here in the events.py file as opposed to reading the file a second time from an external function and ensuring that timestamps match up.

I changed the data type returned in event_tims by _read_mff_events() from a list to a dict. I felt this was better than returning an extra variable.

Since the original #10121, I see #8038 has been opened and this data is being read by mffpy. These changes allow the eventTrack data to make its way into Annotations.

@obergmartin obergmartin marked this pull request as ready for review June 17, 2026 21:11
@larsoner

larsoner commented Jun 19, 2026

Copy link
Copy Markdown
Member

Would it be possible to modify some existing test to show this works? Even something like

assert raw.annotations[0]["extras"]["label"] == ...

or whatever you need to do to show that some info is being pulled in would be great

Also there are some failures in CIs like

_______________________ test_io_egi_pns_mff_bug[False] ________________________
mne\io\egi\tests\test_egi.py:354: in test_io_egi_pns_mff_bug
    raw = read_raw_egi(
<decorator-gen-480>:10: in read_raw_egi
    ???
mne\io\egi\egi.py:176: in read_raw_egi
    return _read_raw_egi_mff(
<decorator-gen-477>:10: in _read_raw_egi_mff
    ???
mne\io\egi\egimff.py:362: in _read_raw_egi_mff
    return RawMff(
<decorator-gen-478>:10: in __init__
    ???
mne\io\egi\egimff.py:584: in __init__
    self.set_annotations(Annotations(**annot))
                         ^^^^^^^^^^^^^^^^^^^^
mne\annotations.py:412: in __init__
    _check_o_d_s_c_e(onset, duration, description, ch_names, extras)
mne\annotations.py:204: in _check_o_d_s_c_e
    extras = _validate_extras(extras, len(onset))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mne\annotations.py:153: in _validate_extras
    raise ValueError(
E   ValueError: extras must be None or a list of length 1, got 0.

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.

Read Net Stations' ECI events information

2 participants