Repository navigation
[GUI] Separate the EEG export filename and format dialogs - #951
arnodelorme wants to merge 4 commits into
Conversation
|
🤖 Review before taking this out of draft. State. The updated parent (#923) is merged in ( What I checked against Findings, none blocking.
Verdict: ready for review. |
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 24s —— View job Code review
BlockingNone. Important
Nits
Test gapsThe test never closes the epoch question with EEGLAB parity notes
Monkeypatching Out of scope, not caused by this PR: the Checked for correctness bugs, EEGLAB parity, data structure compatibility, tests for the changed behavior, and AGENTS.md compliance. Two inline comments were posted. |
| if not filename: | ||
| return None | ||
| if int(EEG.get("trials") or 1) > 1 and not result.get("concatenate", True): | ||
| result = inputgui(pop_writeeeg_dialog_spec(), renderer=renderer) |
There was a problem hiding this comment.
Important: if the file name has an extension, the default format can make the export fail.
The format list always opens on EDF (value=1). If the user types recording.bdf or recording.gdf in the save dialog and clicks Ok, output_type becomes "edf". The extension check at
eegprep/src/eegprep/functions/popfunc/pop_writeeeg.py
Lines 72 to 77 in 9498a72
TYPE EDF does not match the extension .bdf. This happens after the user has gone through all three dialogs. Before this PR, the name and the format were in the same form, so the user could fix both before pressing Ok. Now the file chooser is already closed. EEGLAB never fails here, because writeeeg writes whatever name it gets.
Suggested fix: set the default selection from the chosen extension and fall back to EDF otherwise. For example, pass the value into the spec:
suffix = Path(filename).suffix.lstrip(".").upper()
default = _FORMATS.index(suffix) + 1 if suffix in _FORMATS else 1
result = inputgui(pop_writeeeg_dialog_spec(default), renderer=renderer)Here pop_writeeeg_dialog_spec(value: int = 1) forwards the value to the listbox. Add one case to test_pop_writeeeg_dialog_selects_filename_then_format: a .bdf name with the default selection should write a BDF file.
| "Yes", | ||
| "Yes", | ||
| ) | ||
| if answer != "Yes": |
There was a problem hiding this comment.
Nit (EEGLAB parity): closing the epoch question works differently from EEGLAB, and this difference is not documented.
pop_writeeeg.m only stops on an explicit No: if strcmpi(res, 'No'), return; end. If the user closes the question without answering, questdlg2 returns '' and EEGLAB carries on to the file chooser. Here, answer != "Yes" cancels the export. The author's review comment calls this a known difference. However, neither resources/help/pop_writeeeg.md nor the test records it, and the review standard requires an intentional deviation to be documented and covered by a test.
Suggested fix: pick one of these:
- Match EEGLAB with
if answer == "No": return None(one line, and the current test still passes). - Keep the safer behavior, add a sentence to the help ("Closing the epoch question cancels the export"), and add a
""answer to the test sequence.
The public export first asks whether to concatenate epoched data, then opens the save chooser and the EDF/GDF/BDF list. Cancellation at each stage returns an empty command. The Help button opens the packaged format help. Stacked on #923 (
agent/issue-875-file-chanevent).Measurements and verification
Native client geometry on jamming was 276.8 × 183.3 px in MATLAB, 417 × 223 before and 276 × 183 after. Screenshots use each toolkit’s captured frame. BIOSIG read back both writers’ EDF, BDF and GDF outputs from the same continuous sample. MATLAB padded to 30,592 samples. EEGPrep preserved 30,504. The histogram compares the overlapping 32 EEG channels only. Its normalized distances were 3.69e-5, 1.54e-5 and 7.90e-8. BIOSIG also exposed an additional event channel for MATLAB EDF. It reported 128 Hz for MATLAB and 128.00044 Hz for the EEGPrep EDF and BDF headers. The Qt list scrolls to the last format on Linux. The focused File menu run passed 246 tests (six deselected). Both source trees passed the capture safeguards.
Closes #952. Part of #875.
Full inventory report for the project team. pop_writeeeg (p. 20). PDF · Editable Word.