Repository navigation
[BIDS] Match the EEGLAB layout of the BIDS import window - #720
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Claude finished @arnodelorme's task in 1m 17s —— View job Code review
BlockingNone. Important
Nits
Test gapsNone beyond the BOM/Latin-1 header case above. The new test covers the behavior that changed: columns are combined across files and ordered with EEGLAB parity notes
Checked for correctness bugs, EEGLAB parity, data structure compatibility, tests for the changed behavior, and CLAUDE.md/AGENTS.md compliance. |
| for events in source.rglob("*events.tsv"): | ||
| try: | ||
| table = read_bids_table(events) | ||
| except (OSError, UnicodeError, ValueError): | ||
| with events.open(encoding="utf-8") as stream: | ||
| found.update(stream.readline().rstrip("\r\n").split("\t")) | ||
| except (OSError, UnicodeError): | ||
| continue |
There was a problem hiding this comment.
Important: this header read skips decode_bids_text (
eegprep/src/eegprep/plugins/EEG_BIDS/sidecar.py
Lines 14 to 27 in 7154941
read_bids_table path used.
- A UTF-8 BOM file produces a
"onset"column. That name isn't in_TIMING_COLUMNS, so it shows up in the event type popup. - A Latin-1
events.tsvraisesUnicodeDecodeErrorand is silently skipped.pop_load_frombidsreads the same file throughread_bids_table, so the import can use those columns but the user can't pick them.
Decode the header with the shared helper instead (and import decode_bids_text from sidecar):
| for events in source.rglob("*events.tsv"): | |
| try: | |
| table = read_bids_table(events) | |
| except (OSError, UnicodeError, ValueError): | |
| with events.open(encoding="utf-8") as stream: | |
| found.update(stream.readline().rstrip("\r\n").split("\t")) | |
| except (OSError, UnicodeError): | |
| continue | |
| for events in source.rglob("*events.tsv"): | |
| try: | |
| with events.open("rb") as stream: | |
| header = decode_bids_text(stream.readline(), suffix=".tsv") | |
| except OSError: | |
| continue | |
| found.update(header.rstrip("\r\n").split("\t")) |
The import line also has to change: from eegprep.plugins.EEG_BIDS.sidecar import decode_bids_text, read_bids_table. A header written with encoding="utf-8-sig" in the new test would cover this.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The review bot found that the event type popup read the events.tsv headers without the shared BIDS decoder, so a file saved with a UTF-8 BOM showed a column named "onset" with an invisible BOM character in front and a Latin-1 file was skipped. Commit 945d3b9 now decodes the header with decode_bids_text, adds a BOM file to the dialog test, and names the 1078 pixel width (_DIALOG_WIDTH, the width of EEGLAB's captured window). The test file tests/test_file_menu_audit_673.py passes (68 tests); the one failure, test_real_testmff_matches_eeglab_epochs, is unrelated and comes from defusedxml missing in this local environment. The new BOM case fails on the previous commit and passes now. — orchestrator |

The pop_importbids dialog sizes its columns and rows by EEGLAB's geometry, so the task, run and participant controls line up, the run list is short and greyed while unchecked, and the window has EEGLAB's width. The event type popup lists every events.tsv column, value first, as EEGLAB does. The import code is unchanged.
Captures (EEGLAB, before, after) and tests: https://github.com/adelorme-assistant/project_eegprep/blob/main/reports/pr-707/issue-707_before_after.pdf (Word: https://github.com/adelorme-assistant/project_eegprep/blob/main/reports/pr-707/issue-707_before_after.docx)
Fixes #707
Part of #742