Skip to content

GUI audit Nov 23: File menu and data I/O fixes (BIDS resave overwrite, .study format, text export, importers, BIDS tools) #673

Done

Description

@suraj-ranganath

Summary

Hands-on GUI audit of the File menu (and the data import/export code behind it) on Nov 23, 2026, done as a researcher would: real menu clicks in the eegprep Qt GUI next to the EEGLAB GUI on the same screen, the same real datasets in both, outputs saved and compared file by file. This issue collects every File-menu finding (FAIL, MINOR, MISSING and NOT TESTED) into one stream so one PR can fix them together. Edit and Tools findings are in the companion issue #675 (Edit/Tools stream).

  • eegprep: develop at 6b8012cf2e1f7f1e336e963b77b464754393cbf3 (re-checked with git fetch origin develop on Nov 23 11:05 PST: develop has not moved, so every file:line below is current and nothing here is fixed yet)
  • EEGLAB: pinned tree 8ac485f6 (PINNED_COMMIT.txt = 8ac485f65). Neuroscan readers from sccn/neuroscanio 5915f10 and MFF from mffmatlabio (the pin only offers to download them)
  • Each finding was re-read from first principles against the EEGLAB source for the affected function; where that changed the audit's original root cause, the corrected cause is given below.

Datasets used (all public)

Name in this issue Source
eeglab_data.set, eeglab_data_epochs_ica.set sample_data/ in this repo (and EEGLAB sample_data/)
eeglab_data_numerical_events.set, test.bdf, test.cnt, testmff.mff, testbva.vhdr EEGLAB sample_data/test_data/
TESTEEG.EEG Neuroscan epoched .EEG test file (32 ch, 700 pnts, 1200 sweeps) used by the neuroscanio tests
P300 BIDS OpenNeuro ds003061, sub-001 only (79 ch, 194048 pnts, 863 events)
nepo01.edf 20 ch, 200 Hz, 812 s EDF
epochinfo.txt 81 lines, tab separated, header Epoch RT Cond, row k = k 297+3k (1 if k odd else 2) for k = 1..80
ascii_4x512.txt 4 x 512 random ASCII matrix
STUDY auditstudy eeglab_data.set (S1) + eeglab_data_numerical_events.set (S2), task task1

Evidence (screenshots, saved outputs, clobbered files) is on the bot box under /workspace/gui-parity/audit-20261123/ (screenshots/, epout/, mlout/, findings.md, items_final.json). File names are quoted per finding.

Separability with #675 (Edit/Tools)

This stream owns: functions/guifunc/menu_actions.py (File-menu handlers only), functions/popfunc/ importers/exporters (pop_importdata, pop_biosig, pop_loadcnt, pop_fileio, pop_chanevent, pop_importepoch, pop_export, pop_expevents, pop_saveset, pop_loadset, pop_runscript, pop_saveh), functions/adminfunc/eeg_checkset.py (epoch event fields only), functions/studyfunc/, plugins/EEG_BIDS/, resources/extension_catalog.json. The Edit/Tools stream owns functions/guifunc/qt.py and the shared inputgui error handling; if this PR needs a change there, coordinate in the other PR.


A. Critical and high

1. BIDS import never writes derivatives; Resave then overwrites the raw BIDS file (FAIL, critical)

Menus: File > Import data > Using EEGPrep functions and plugins > From BIDS folder structure and File > BIDS tools > Import BIDS folder to STUDY (same callback).

  • Repro: File > Import data > ... > From BIDS folder structure, pick the ds003061 folder, accept the pop_importbids defaults (event type value, output derivatives/eeglab), Ok. Then File > Resave current dataset(s). Compare md5sum sub-001/eeg/sub-001_task-P300_run-1_eeg.set before and after.
  • eegprep now: dataset loads correctly (79 ch, 863 events, F16/F123 fixed) but nothing is written to derivatives/eeglab, EEG.filename/filepath still point at the raw BIDS .set, and Resave overwrites the source: md5 2975e3a5 -> bd90fed4, size 63516912 -> 63607968 (epout/clobbered_bids_source.set, screenshots/ep_bids_resave_20261123_022928.png). History also records 'return_study', 'on', an option EEGLAB does not have. No Help button; event-type popup lists every events.tsv column. Import-to-STUDY picker opens in the repo folder.
  • EEGLAB: plugins/EEG-BIDS/pop_importbids.m:287-296 builds the output subject folder under opt.outputdir (default bidsFolder/derivatives/eeglab, line 182), :769 pop_saveset(EEG, eegFileNameOut) writes each dataset there, :863-867 writes <studyName>.study with std_editset, :892 resaves. The source tree is never a save target (md5 unchanged in EEGLAB).
  • Root cause: src/eegprep/plugins/EEG_BIDS/pop_importbids.py:84-95 loads with pop_load_frombids and returns without saving; functions/guifunc/menu_actions.py:1997-2001 _resave_set_path accepts any existing .set; pop_importbids.py:462-477 _history_command appends return_study.
  • Fix: (a) save each imported dataset into outputdir/sub-XX[/ses-YY]/eeg/ and write the .study there, set filename/filepath to the saved copy, exactly as pop_importbids.m:625,769,863; (b) defence in depth: _saveset(resave=True) (menu_actions.py:608) and pop_saveset(savemode='resave') refuse a target that sits inside a BIDS root (a parent folder holds dataset_description.json and the path is outside derivatives/), with a message naming pop_saveset and telling the user to use Save as; (c) drop return_study from history; (d) add the Help button and restrict the event-type popup to the columns EEGLAB offers; (e) start the folder picker in the last data folder.
  • Test: GUI test that imports a tiny BIDS fixture into a tmp dir, asserts derivatives .set + .study exist, EEG.filepath is under derivatives/eeglab, and Resave leaves the source md5 unchanged; unit test for the BIDS-root guard; history string test.
  • Derivatives written, source untouched after Resave (both menu entries)
  • Resave guard with an actionable message
  • History matches pop_importbids(folder, 'eventtype', 'value', ...) with no return_study

2. Import event info > From data channel: wrong edges, bool types, transform parser too strict (FAIL, high)

  • Repro: load eeglab_data.set, File > Import event info > From data channel, channel 2 (EOG1), transform X > 50 (with spaces, as the label suggests), transitions Up, keep channel, Ok. Retry with X>50.
  • eegprep now: X > 50 fails with "Only simple X>threshold or X<threshold expressions are supported". X>50: 286 events typed True/False (rising and falling edges) while history says 'edge','leading'. Dialog defaults differ: channel 1, Both, length 1, example X > 0 (screenshots/ep_chanev_dlg_20261123_024736.png vs ml_chanev_dlg_20261123_024836.png).
  • EEGLAB: functions/popfunc/pop_chanevent.m:224-231 evaluates the transform as MATLAB code on the double channel (X = X>50; gives 0/1 doubles); :236-240 diff(abs([X X(end)])) then find(tmpdiff > 0) for leading edges; dialog defaults at :126-147: channel blank, up (leading), length 0, example X>3. Result: 143 events, all type 1, at rising edges (474, 536, 620, ...).
  • Root cause: src/eegprep/functions/popfunc/pop_chanevent.py:216-223 _apply_oper returns a bool array and only accepts X>n/X<n without spaces; pop_chanevent.py:127 np.diff(np.abs(...)) on bool is XOR, so every change is "> 0" and the values become the event types.
  • Fix: cast the transformed channel to float64 before the diff; replace _apply_oper with a small safe evaluator over X (comparison, arithmetic, abs, round, bitand, &, |, parentheses; no names other than X and whitelisted numpy functions; never Python eval on raw text), accepting spaces and an X = ... form as EEGLAB does; set dialog defaults to EEGLAB's.
  • Test: regression test on eeglab_data.set channel 2 with X>50, leading: 143 events, all type 1, latencies equal to EEGLAB's (MATLAB parity script on jamming); parser tests for spaced and compound expressions and for rejection of unsafe input with a message naming pop_chanevent.
  • 143 events match EEGLAB exactly
  • Defaults match pop_chanevent.m
  • Safe evaluator with clear errors

3. Import epoch info: dataset cannot be saved afterwards, partial file left on disk (FAIL, high)

  • Repro: load eeglab_data_epochs_ica.set, File > Import epoch info > From MATLAB array or ASCII file, file epochinfo.txt, fields epoch RT cond, latency field RT, time unit 1E-3, header lines 1, Ok, then File > Save current dataset as ep_impep.set.
  • eegprep now: events match EEGLAB exactly (317 events incl. TLE and RT; F22 fixed), but Save as fails with pop_saveset: Could not convert None (type NoneType) to array and leaves an unreadable 369 KB ep_impep.set plus .fdt (epout/ep_impep_PARTIAL.set, screenshots/ep_impep_save_error_20261123_025318.png). The main window keeps the old filename.
  • EEGLAB: new events get position = []; eeg_checkset builds EEG.epoch(k).eventposition = {2, [], [], 2, 2} and the save works.
  • Root cause (verified Nov 23 by scripting the same call): the None is in EEG.epoch[0]["eventposition"] == [2.0, None, None, 2.0, 2.0], created by src/eegprep/functions/adminfunc/eeg_checkset.py:580 tmpevent[idx].get(fname, None) when an event lacks a field. pop_saveset.py:559-571 writes the .fdt first, then scipy.io.savemat raises TypeError, which neither the ValueError nor the OSError handler catches, so the partial .set stays.
  • Fix: in eeg_checkset.py:580 use an empty array (MATLAB []) for a missing field; in pop_saveset map any remaining None to an empty array before savemat, write .set and .fdt to temp names in the target folder and os.replace them only after both succeed, and report a failure as pop_saveset: could not write <file>: field EEG.epoch(1).eventposition holds an unsupported value (...).
  • Test: scripted pop_importepoch + pop_saveset + pop_loadset round trip; a unit test that forces a savemat failure and asserts no .set/.fdt remain and the original file (if any) is intact; MATLAB check that the saved set loads in EEGLAB with 317 events.
  • Save works after Import epoch info, reload equals EEGLAB
  • Atomic save, no partial files on any exception type

4. Export > Data and ICA activity to text file scrambles epoched data (FAIL, high)

  • Repro: load eeglab_data_epochs_ica.set (80 epochs), File > Export > Data and ICA activity to text file, defaults (transpose on, labels, time in ms, 4 digits), save, diff against EEGLAB's file.
  • eegprep now: row 2 (time -992.19 ms) holds sample 1 of epoch 2 (FPz -22.70 where EEGLAB has 14.77); 982,950 of 983,040 values differ (max 532 uV); time column and header are right, so the file looks plausible (epout/ep_export.txt). Lines end in CRLF on Linux.
  • EEGLAB: pop_export.m uses MATLAB reshape(data, nbchan, pnts*trials) (column-major): epoch 1 samples 1..pnts, then epoch 2. LF line endings.
  • Root cause: src/eegprep/functions/popfunc/pop_export.py:60 and :64 reshape (chan, pnts, trials) in C order; csv.writer default lineterminator is \r\n.
  • Fix: reshape(nbchan, pnts * trials, order="F") in both places (data and expr result, ICA activations through _selected_data); pass lineterminator="\n".
  • Test: epoched export parity test (byte-compare numbers with an EEGLAB-written reference generated on jamming, or an analytic check that row r equals data[:, r % pnts, r // pnts]); line-ending test.
  • Epoched export identical to EEGLAB numbers
  • LF endings

5. File > Save current study overwrites an EEGLAB MAT .study with JSON (FAIL, high) and Save current study as writes JSON (MINOR)

  • Repro: load the EEGLAB-written auditstudy_ml.study (MAT 5.0, md5 789a4b12), File > Save current study. Then File > Save current study as auditstudy.study, and open both files in EEGLAB pop_loadstudy.
  • eegprep now: the MAT file is replaced in place by JSON text (md5 3ad1a2aa, starts with {; epout/clobbered_auditstudy_ml.study), with no warning; EEGLAB then fails: "STUDY set file not loaded -- check filename and path". Save as also writes JSON. No "Some datasets have been modified, resave them?" prompt. History STUDY = pop_savestudy(STUDY, ALLEEG, filename=..., filepath=...) is Python keyword form.
  • EEGLAB: functions/studyfunc/pop_savestudy.m:170-183 strips data fields (std_rmalldatafields) and saves with save('-v6', STUDYfile, 'STUDY') when option_saveversion6 is 1 (the default, eeg_optionsbackup.m:9), falling back to -v7.3. (The audit text said "MAT v7"; the pin writes v6, i.e. a MAT 5 file.) The resave prompt comes from pop_savestudy.m GUI path.
  • Root cause: src/eegprep/functions/studyfunc/pop_savestudy.py:54 always write_json(path, study); docs/source/user_guide/study_workflows.rst:77 documents JSON. eegprep's own pop_loadstudy already reads MAT studies, so the asymmetry only hurts.
  • Expected: a .study file written by eegprep opens in EEGLAB. Write a MAT 5 .study with scipy.io.savemat using EEGLAB's STUDY struct layout after the equivalent of std_rmalldatafields; keep JSON only when the user asks for it explicitly (e.g. format='json' or a .json name); update study_workflows.rst:77; add the modified-datasets prompt; write history as [STUDY ALLEEG] = pop_savestudy( STUDY, ALLEEG, 'filename', 'x.study', 'filepath', '/path');.
  • Test: round trip eegprep save -> EEGLAB pop_loadstudy on jamming (2 datasets, names, subjects, task preserved); eegprep save -> eegprep load; resave of an EEGLAB MAT study keeps MAT format; history string test.
  • Both Save study entries write EEGLAB-readable MAT
  • Resave of a MAT study never converts it
  • Prompt and MATLAB-form history

B. Medium

6. Neuroscan .CNT: latencies one sample early, first boundary lost (FAIL, medium)

  • Repro: File > Import data > ... > From Neuroscan .CNT file, test.cnt, dialog defaults, Ok, save; compare with neuroscanio pop_loadcnt('test.cnt').
  • eegprep now: data identical for samples 1-25600; 25605 samples (EEGLAB reads 3 extra garbage tail samples, -9166 and zeros; eegprep's length is correct: keep it and document it). Events 11 vs 12: the boundary at offset 3737 is missing and every latency is one sample early (5913 vs 5914).
  • EEGLAB (neuroscanio 5915f10): pop_loadcnt.m:150-153 builds events with only type and latency = offset + 1; no duration field, so the EEGLAB eeg_checkset.m:424-426 rule "drop a leading boundary whose duration < 1" never fires.
  • Root cause (corrected from first principles): src/eegprep/functions/popfunc/pop_loadcnt.py:129 uses offset as latency (0-based), and pop_loadcnt.py:130 adds duration = 0.0, which makes the faithful port of that EEGLAB rule in eeg_checkset.py:95-98 drop the first boundary when pop_loadcnt.py:57 calls eeg_checkset(eeg, "eventconsistency"). eeg_checkset is right; the importer is wrong.
  • Fix: latency offset + 1; leave duration unset for CNT events (or NaN, matching EEGLAB's struct, then check eeg_checkset treats it like a missing field); record EEG = pop_loadcnt('file', 'dataformat', 'auto');-style history; document the 3-sample tail difference as deliberate in docs/source/user_guide/eeglab_migration.rst with a test.
  • Test: CNT parity test against neuroscanio: 12 events, identical types and latencies, first boundary at 3738; tail-length documented-difference test.
  • 12 events with EEGLAB latencies
  • Tail difference documented and tested

7. Neuroscan .EEG goes through pop_fileio: no TLE/RT events (FAIL, medium)

  • Repro: File > Import data > ... > From Neuroscan .EEG file, TESTEEG.EEG, defaults, save; compare with neuroscanio pop_loadeeg.
  • eegprep now: data identical (maxdiff 0, 32 x 700 x 1200; F119 fixed) but the pop_fileio dialog is shown and the 6000 events are per-trial metadata entries at the epoch start; no time-locking event at 0 and RTs are values instead of events, so epoching/sorting by response cannot work. History pop_fileio.
  • EEGLAB: neuroscanio pop_loadeeg.m dialog (precision, trial/type/electrode/response subsets), 2399 events: one TLE at time 0 per epoch and an RT event at the response latency, with accept/response/epochtype fields; setname Neuroscan EEG data.
  • Root cause: functions/guifunc/menu_actions.py:712-715 routes everything unmatched to pop_fileio; functions/sigprocfunc/loadeeg.py exists but there is no pop_loadeeg wrapper.
  • Fix: add functions/popfunc/pop_loadeeg.py (EEGLAB dialog, TLE/RT events from the sweep headers as pop_loadeeg.m does), route .eeg/.EEG to it, history EEG = pop_loadeeg('file', ...).
  • Test: parity against neuroscanio on TESTEEG.EEG: 2399 events, types, latencies, fields; GUI routing test.
  • pop_loadeeg with EEGLAB dialog and events

8. Magstim/EGI .mff: segments glued, synthetic stim channels added, events thin (FAIL, medium)

  • Repro: File > Import data > ... > Import Magstim/EGI .mff file, pick testmff.mff (segmented, 257 ch, 250 Hz, 2 segments), defaults, save; compare with mffmatlabio pop_mffimport.
  • eegprep now: 261 ch x 600 continuous: two segments glued and 4 MNE stim channels (stm+, resp, fbk+, LRND) added as data. EEG channels match to 3.6e-15. 8 events (2 ULRN missing), type/latency/duration only. History pop_fileio.
  • EEGLAB: 257 ch x 300 x 2 epochs, xmin -0.202 s, 10 events with code, label, mffkeys, epoch.
  • Root cause: menu_actions.py:712-715 routes MFF to pop_fileio, which reads through MNE read_raw_egi (adds stim channels, ignores segments).
  • Fix: add pop_mffimport (port of mffmatlabio's reader or mne.read_epochs_egi for segmented files) that drops MNE synthetic stim channels, keeps segments as epochs, carries the MFF event keys, and records EEG = pop_mffimport('file', ...).
  • Test: parity against mffmatlabio on testmff.mff: shape 257 x 300 x 2, xmin, 10 events and fields.
  • Shape, epochs and events match mffmatlabio

9. BIDS tools > Edit BIDS task info: values never reach the export (FAIL, medium)

  • Repro: STUDY auditstudy loaded, File > BIDS tools > Edit BIDS task info, fill Dataset name, Task name, README, Line frequency 60, Ok; then File > Export > To BIDS.
  • eegprep now: values stored in STUDY.etc.bids.task only; export still writes PowerLineFrequency: "n/a" and dataset_description.json Name EEGPrep export. One scrolling column without * marks; README is a single-line box; a history line is written (EEGLAB writes none).
  • EEGLAB: plugins/EEG-BIDS/pop_taskinfo.m:227 writes EEG(a).BIDS = bids (tInfo/gInfo) into every dataset and marks it unsaved; pop_taskinfo.m:294-338 and pop_exportbids read them back from the datasets. Quirk: the EEGLAB dialog is taller than a 1200 px screen (Ok/Cancel under the taskbar); eegprep's scrolling layout is the better behaviour to keep.
  • Root cause: plugins/EEG_BIDS/bids_tools.py:66-83 writes to the target (the STUDY); pop_exportbids.py:210-223 _task_info reads only each dataset's etc.bids.task; pop_exportbids.py:235,246 hard-code EEGPrep export.
  • Fix: when the target is a STUDY, copy the task section to every ALLEEG entry (and mark them unsaved), or make _task_info merge STUDY-level info; use Name for dataset_description.json; multi-line boxes for README/description; mark required fields with *.
  • Test: pop_taskinfo on a STUDY then pop_exportbids: eeg.json PowerLineFrequency 60, dataset_description Name equals the typed name.
  • Task info reaches the exported files

10. BIDS tools > Edit BIDS participant info: single-subject form (FAIL, medium)

  • Repro: STUDY auditstudy (S1, S2), File > BIDS tools > Edit BIDS participant info.
  • eegprep now: one flat form for one subject (sub-S1); no way to enter S2; no column metadata.
  • EEGLAB: plugins/EEG-BIDS/pop_participantinfo.m: table with one row per participant and columns participant_id/Gender/Age/Group/HeadCircumference/..., plus a BIDS metadata table (Description, Levels, Units), Import column(s), Add/Edit column, Remove column.
  • Root cause: bids_tools.py:86-103,143-156 pop_participantinfo uses the flat pop_participantinfo_dialog_spec.
  • Fix: QTableWidget dialog with one row per STUDY dataset/subject and the metadata table; store each row in ALLEEG(k).etc.bids.participant (consumed by _write_participants, pop_exportbids.py:412) and column descriptions for participants.json.
  • Test: GUI renderer test filling two rows; export writes both rows to participants.tsv and descriptions to participants.json.
  • Per-participant table and metadata written on export

11. File > Create study > Simple ERP STUDY has no dialog (FAIL, medium)

  • Repro: two datasets loaded, File > Create study > Simple ERP STUDY.
  • eegprep now: builds Simple ERP STUDY from whatever is loaded (S1/S2, no conditions) at once; user cannot pick files, conditions or subject count. History STUDY, ALLEEG = pop_studyerp(ALLEEG).
  • EEGLAB: functions/studyfunc/pop_studyerp.m: memory warning, "Create simple ERP STUDY" dialog (Number of conditions 1, Number of subjects 15), then a subjects x conditions grid of dataset boxes with browse buttons; builds on Ok.
  • Root cause: menu_actions.py:978-981 calls pop_studyerp(self.session.ALLEEG) without GUI.
  • Fix: port both pop_studyerp dialogs and build only on Ok; MATLAB-form history.
  • Test: GUI renderer test: counts dialog, grid, Ok builds the STUDY with the chosen files/conditions; Cancel changes nothing.
  • Two dialogs, builds on Ok only

12. File > BIDS tools > BIDS export wizard fails without a loaded dataset (FAIL, medium)

  • Repro: no dataset loaded (the menu is enabled in both GUIs), click the item.
  • eegprep now: error box bids_exporter: No current dataset.
  • EEGLAB: plugins/EEG-BIDS/bids_exporter.m: "Welcome to the EEG-BIDS exporter tool!" page, Continue opens a file grid (raw file, browse, subject, session, run, condition, group, task) so raw files export without loading.
  • Root cause: plugins/EEG_BIDS/bids_tools.py:61-63 bids_exporter needs EEG.
  • Fix: port the welcome page and the file grid (load each file, apply the grid metadata, call pop_exportbids); if any part is deferred, disable the item with no dataset and show a tooltip explaining why.
  • Test: GUI renderer test from an empty session exporting two raw files.
  • Wizard works from an empty session

C. Minor (File menu)

13. Export > To BIDS and BIDS tools > Export STUDY to BIDS folder (MINOR, medium)

  • Repro: STUDY auditstudy, File > Export > To BIDS (and File > BIDS tools > Export STUDY to BIDS folder, same callback), defaults, export; diff the tree against EEGLAB's export of the same STUDY; run bids_validator.
  • eegprep now: no power line prompt (writes n/a); 17 files vs EEGLAB 19: no participants.json, no task-task1_events.json; _run-01 on every name; sub-S1_run-01_coordsystem.json fails the validator; EEGChannelCount 32 with the EOG channels counted as EEG; events.tsv sample column integer (EEGLAB 128.0087). channels.tsv types EEG/uV are better than EEGLAB's n/a: keep.
  • EEGLAB: pop_exportbids.m:100-112 (GUI path) forces a 50/60 Hz choice when PowerLineFrequency is missing; bids_export.m:770-773 adds run- only when a subject has more than one run, :843-846; :840-842 writes task-<task>_events.json; :633- writes participants.json; eeg_getchantype.m:60-66 infers channel type from the label (EOG1 -> EOG), giving EEGChannelCount 30 + EOGChannelCount 2. bids_writeelectrodefile.m:32-49 removes task- and desc- only, so EEGLAB itself would write an invalid run- coordsystem name for multi-run subjects (EEGLAB quirk).
  • Root cause: plugins/EEG_BIDS/pop_exportbids.py:395 always appends _run-{run}; :509-511 _electrode_basename keeps run-; :221,478 default n/a with no prompt (and the known-difference note at :139 only covers the scripted path); :480 EEGChannelCount = nbchan; bids_preproc.py:1078-1087 counts types only; participants.json and events.json writers missing.
  • Fix: run entity only when a subject has several datasets (or forcerun); drop run- (and every entity BIDS disallows) from coordsystem names, documented as a deliberate difference from bids_writeelectrodefile.m with a test; GUI prompt for power line frequency as EEGLAB; write participants.json and task events.json; count channel types by label as eeg_getchantype.m does; keep the integer sample column (BIDS defines it as the onset in samples of the raw file; EEGLAB bids_writeeventfile.m:95,113 copies the fractional latency) and document it as a deliberate difference with a test.
  • Test: export the 2-subject STUDY; assert file list equals EEGLAB's 19 files, validator passes (bids_validator package), eeg.json counts 30/2, PowerLineFrequency set.
  • File list and sidecars match EEGLAB, validator clean

14. BIDS tools > Edit BIDS event info is a flat form (MINOR, medium)

  • Repro: STUDY loaded, File > BIDS tools > Edit BIDS event info.
  • eegprep now: seven text boxes mapping BIDS columns to one string; no Levels/LongName/Description/Units; cannot add a field.
  • EEGLAB: plugins/EEG-BIDS/pop_eventinfo.m editable table (BIDS Field, EEGLAB Field, Levels, LongName, Description, Unit Name, Unit Prefix) with Add/Remove BIDS field.
  • Root cause: bids_tools.py:106-119,157-176 flat pop_eventinfo_dialog_spec.
  • Fix: port the table; write its content to task-<task>_events.json on export (ties to item 13).
  • Test: GUI renderer test editing Levels/Description; exported events.json contains them.
  • Table dialog feeding events.json

15. BIDS tools > Validate BIDS dataset misses file-name errors (MINOR, low)

  • Repro: File > BIDS tools > Validate BIDS dataset on an eegprep export that contains sub-S1_run-01_coordsystem.json.
  • eegprep now: clear message, 0 errors 0 warnings, "sidecar check only", install hints for the official validator.
  • EEGLAB: the pin has no bids-validator plugin (menu offers to install it or opens the web validator).
  • Root cause: bids_tools.py:178 validate_bids fallback checks sidecars only.
  • Fix: in the fallback, also run bids_validator.BIDSValidator().is_bids() (installed with the extras) on every relative path and report invalid names.
  • Test: fixture with an invalid coordsystem name produces one error naming the file.
  • Fallback flags invalid names

16. Create study > Browse for datasets builds the STUDY with no grid (MINOR, medium)

  • Repro: File > Create study > Browse for datasets, pick two .set files.
  • eegprep now: multi-file picker then an immediate STUDY (EEGPrep study, S1/S2, no session/condition/group). History pop_studywizard(filenames=[...], name=...).
  • EEGLAB: memory warning, then the pop_studywizard grid (row per dataset with browse, subject, session, run, condition, group, task); built on Ok.
  • Root cause: menu_actions.py:964-977 calls pop_studywizard(filenames) without its dialog.
  • Fix: show the grid prefilled with the picked files; build on Ok; MATLAB-form history.
  • Test: GUI renderer test setting condition/group then Ok.
  • Grid shown, values applied

17. Create study > Using all loaded datasets: history not runnable (MINOR, low)

  • eegprep now: pre-fills S1/S2 so Ok works the first time (EEGLAB errors "All datasets must have a subject name or code" until typed; keep eegprep's friendlier default and document it); no memory warning; history STUDY, ALLEEG = pop_study(STUDY, ALLEEG, name=..., commands=[...]).
  • EEGLAB: history [STUDY ALLEEG] = std_editset( STUDY, ALLEEG, 'name', ..., 'commands', {...}, 'updatedat', 'on' );.
  • Root cause: Python-kwarg history builders in functions/studyfunc/ (build_python_call, 59 uses).
  • Fix: EEGLAB-form history for every File-menu STUDY command (pop_study, pop_studywizard, pop_studyerp, pop_loadstudy, pop_savestudy); document the S1/S2 prefill.
  • Test: history string tests per command.
  • MATLAB-form STUDY history

18. History scripts > Run script cannot run the scripts eegprep saves (MINOR, medium)

  • Repro: File > History scripts > Run script on a 5-line EEGLAB .m (loadset, eegfiltnew 1 Hz, eeg_store, redraw), then the same steps as .py.
  • eegprep now: .m: "pop_runscript: EEGPrep can only run Python history scripts" although the picker offers *.m and eegprep's Save history writes only .m. .py works.
  • Root cause: functions/popfunc/pop_runscript.py:21-23; menu_actions.py:1017 (save filter *.m only), :1042 (run filter *.py *.m *.txt).
  • Expected: a user can replay what they saved. Offer Save history as .py (Python calls exist for every command) next to .m, and run .m files whose lines are recognised pop_*/eeg_* calls through the existing history translator, with a clear message listing any line it cannot run.
  • Test: save history as .py, run it, dataset equals the original; .m with supported lines runs; unsupported line gives a message naming the line.
  • Saved history can be replayed

19. History scripts > Save dataset history script (MINOR, low)

  • eegprep now: adds this session's pop_saveset lines to EEG.history (EEGLAB does not); picker opens in the repo folder; LASTCOM says pop_saveh(ALLCOM, ...) for the dataset variant.
  • Root cause: functions/popfunc/pop_saveh.py:40 always ALLCOM; saves appended to EEG.history in the save path.
  • Fix: pop_saveh( EEG.history, 'name', 'path'); for the dataset variant; start in the dataset folder; stop logging saves into EEG.history (keep them in ALLCOM).
  • Test: history strings; EEG.history unchanged by a save.
  • Matches EEGLAB file and LASTCOM

20. Save session history script and Load existing dataset: pop_loadset history form (MINOR, low)

  • eegprep now: EEG = pop_loadset('/full/path/file.set'); (menu_actions.py:568); session file also writes pop_editoptions lines without the leading output. Load error messages are clear and better than EEGLAB's (keep).
  • EEGLAB: EEG = pop_loadset('filename', 'file.set', 'filepath', '/path/');.
  • Fix: EEGLAB form in menu_actions.py:568 and wherever pop_loadset history is built; fix the pop_editoptions line form. Re-check F15 (HDF5 load error) with sample_data/eeglab_data_hdf5.set.
  • Test: history strings; HDF5 sample loads or gives an actionable message.
  • MATLAB-form loadset history; F15 re-checked

21. Manage EEGPrep extensions: empty catalog (MINOR, low)

  • eegprep now: lists the 5 bundled extensions; resources/extension_catalog.json has 0 entries so there is nothing to install and "Copy commands" stays disabled.
  • Fix: ship a short curated catalog (see docs/source/user_guide/extension_curation.rst) or state in the dialog that third-party extensions are pip packages and how to find them.
  • Catalog or explanation shown

22. Export > Events to text file: CRLF (MINOR, low)

  • Root cause: functions/popfunc/pop_expevents.py:38 and :81 csv writers default to CRLF. Content is identical to EEGLAB.
  • Fix: lineterminator="\n". Test: byte compare with EEGLAB output.
  • LF endings

23. Importers skip pop_newset; ASCII import dialog closes on error (MINOR, low)

  • Repro: File > Import data > ... > From ASCII/float file or MATLAB array, Ok with no file; then import ascii_4x512.txt at 128 Hz.
  • eegprep now: data identical (maxdiff 0); clear error with no file but the dialog closes; the dataset is stored directly with no pop_newset step (same for BDF/EDF/BIOSIG/CNT/EEG/MFF/BVA). Extra "Auto detect" format and free-text About field.
  • EEGLAB: every importer goes through eeglab_new -> pop_newset (name, save as file).
  • Root cause: menu_actions.py:685-719 calls _store_current_from_gui(new=True) directly.
  • Fix: route new datasets from importers through the pop_newset dialog; the keep-dialog-open behaviour is shared with Edit/Tools (handled in GUI audit Nov 23: Edit and Tools fixes (DIPFIT co-registration and fine fit, epoched Select data, firpmord, Inspect/label components) #675 item 22, generic inputgui fix), so only wire it here.
  • Test: GUI test asserts pop_newset opens after import and its name is applied.
  • pop_newset after every import

24. BDF/EDF/BIOSIG interface: options, precision, setname (MINOR, low)

  • Repro: File > Import data > ... > From Biosemi BDF file (test.bdf), From EDF/EDF+/GDF (nepo01.edf), Using the BIOSIG interface.
  • eegprep now: 41/41 events identical, data within float32 rounding; dialog has 7 options (adds Remove marker channel; lacks force continuous, overflow detection, uncalibrated, mexSLOAD); data float64 in memory; setname is the file stem; comments empty.
  • EEGLAB: pop_biosig.m 11 options; eeg_checkset.m:777-779 converts to single when option_single is 1; setname BDF file/EDF file; comments Original file: <path>.
  • Root cause: functions/adminfunc/eeg_options.py:22 declares option_single = 1 but nothing applies it; pop_biosig.py sets setname from the file stem.
  • Fix: either apply option_single (float32 in memory) or document float64 as deliberate in eeglab_migration.rst and make the preferences dialog say the option has no effect (decision for Suraj/Arno; do not change numeric tolerances); EEGLAB setname and comments; add the missing checkboxes or document them.
  • Precision decision implemented or documented; setname/comments match

25. Brain Vision Analyzer .mat import: history names an eegprep-only function (MINOR, low)

  • eegprep now: data and 16 events identical to bva-io pop_loadbva; history pop_fileio_brainvision_mat(...); setname "Brain Vision Analyzer file" (EEGLAB empty); float64.
  • Root cause: menu_actions.py:696-699.
  • Fix: expose pop_loadbva as the public name and record EEG = pop_loadbva('file');.
  • Runnable EEGLAB history

26. Using the FILE-IO interface (MINOR, low)

  • eegprep now: dialog has channel/sample/trial range; no data-format popup, no memory-map option, no File/Folder question. Data and 17 events identical; eegprep names the first event boundary (EEGLAB empty).
  • Fix: add the data-format popup (auto + explicit formats) for ambiguous extensions; document the boundary naming as deliberate with a test.
  • Format popup or documented difference

27. Edit > About this dataset: comments saved as one long row (MINOR, low; lives here because the fix is in pop_saveset)

  • Repro: eeglab_data.set, Edit > About this dataset, add a line Edited by audit, SAVE, File > Save current dataset as, load the file in EEGLAB.
  • eegprep now: paragraph breaks kept on screen and in memory (F48 fixed); the saved .set stores comments as one 1x912 char row with embedded newlines, so EEGLAB shows one long row.
  • EEGLAB: pop_comments.m stores a padded char matrix (one row per line).
  • Root cause: functions/popfunc/pop_saveset.py writes the string as-is.
  • Fix: on save, split comments on newlines into a right-padded char matrix (np.array(lines, dtype='U<n>')); on load, join rows with newlines (check pop_loadset already does).
  • Test: save/reload round trip; MATLAB check that size(EEG.comments, 1) equals the line count.
  • EEGLAB sees one row per line

28. Small follow-ups from PASS rows (File)

  • Document in eeglab_migration.rst: EDF export keeps events as EDF+ annotations and does not pad (EEGLAB adds an event channel and NaN padding, drops annotations); Save as creates a missing folder (EEGLAB errors); Load existing study history is Python form (fix with item 17).
  • BrainVision .vhdr import: add the empty visible event field for struct parity (optional).
  • Main window "size" 4.3 vs 4.4 Mb (F4): use EEGLAB's rounding.

D. Not tested in the audit (must be exercised by this PR's retest)

  • File > Quit: click in both GUIs with a modified unsaved dataset; prompts and outcome must match EEGLAB.
  • File > Import event info > From ERPLAB text files: dialog and Cancel match (EEGLAB still errors on Cancel, pop_importerplab.m line 93 "Dot indexing", F31: keep eegprep's clean Cancel and document it); import with a real ERPLAB event list + bin file and compare events with EEGLAB.

Global definition of done

  • Every checkbox above ticked, or a finding explicitly marked deferred in the PR with Suraj's agreement
  • GUI retest side by side with EEGLAB (pin 8ac485f6) of every File-menu item above, same datasets, screenshots attached to the PR
  • MATLAB parity on jamming for every numeric item (2, 3, 4, 6, 7, 8, 13) with the scripts committed under tests/matlab/
  • Tests added for every finding; no changes to tests/fuzz/, tolerances.toml, goldens or parity JSON (only Suraj or Arno change those)
  • Where EEGLAB has a quirk (CNT tail samples, coordsystem run entity, ERPLAB Cancel, taskinfo dialog height), eegprep does the correct thing, documents it in eeglab_migration.rst, and a test locks it in
  • Error messages name the function and the fix; no comments that restate code or justify workarounds
  • History lines for File-menu commands are runnable in EEGLAB

Activity

  1. added
    bug
    P1
    on Nov 23, 2026
  2. claude commented on Nov 23, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    This is an umbrella issue. I re-checked the main root causes against the current code, and they are accurate:

    Proposed Approach

    The issue asks for one PR. I'd advise against that: it would mix core-function changes (which need the MATLAB reference run and human approval) with large GUI ports, and it would run to several thousand lines. Proposed split, in merge order:

    1. Data-integrity fixes, small, core (items 4, 22, 2, 3, 6). Fixes: order="F" plus lineterminator="\n" in both exporters; cast to float64 before the diff in pop_chanevent, with EEGLAB dialog defaults and a whitelisted AST evaluator for X expressions; np.array([]) instead of None in eeg_checkset, plus an atomic temp-file then os.replace save in pop_saveset; CNT latency = offset + 1 with no duration. Each one gets a failing test first. About 150-250 lines, so this is a single PR that needs the reference-suite run.
    2. No-clobber of source files (items 1 and 5, save side). pop_importbids writes derivatives/eeglab and a .study. pop_savestudy writes a MAT 5 .study via savemat after stripping data fields, and keeps MAT on resave. Add the BIDS-root resave guard and drop return_study from history. This is the most urgent group after group 1, because user data is overwritten today.
    3. History form (items 5, 17, 19, 20, 25). One shared MATLAB-form history builder for STUDY and pop_loadset/pop_saveh commands. Removing Python-kwarg history is a deliberate API decision, so please confirm it applies everywhere build_python_call is used in studyfunc/.
    4. BIDS export and tools (items 9, 13, 14, 15, 10, 12). Fix the run entity, participants.json, events.json, channel type counts and the power-line prompt first, then the table dialogs (participant/event info) and the bids_exporter wizard as separate GUI PRs with visual-parity captures.
    5. New importers (items 7, 8, 26, 24, 23). pop_loadeeg and pop_mffimport are new features, each with neuroscanio/mffmatlabio parity. Route imports through pop_newset after the GUI audit Nov 23: Edit and Tools fixes (DIPFIT co-registration and fine fit, epoched Select data, firpmord, Inspect/label components) #675 inputgui fix lands.
    6. STUDY dialogs and history replay (items 11, 16, 18, 21, 27, 28, D). Port the pop_studyerp and pop_studywizard grids, save and run history as .py, write comments as a char matrix.

    Decisions needed from a maintainer:

    • Is the split OK, or should this really be one PR?
    • Item 24: apply option_single (float32 in memory) or document float64 as deliberate?
    • Item 5: should JSON .study stay available via an explicit format='json', or be removed?
    • Item 18: run .m histories through a translator (new surface), or only offer .py save and replay?

    Once the split is approved I can start group 1 right away (agent/YYYYMMDD-fix-673-io).

  3. added a commit that references this issue on Nov 24, 2026
  4. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_importerplab layout finding is tracked in #955. PR #954 includes the actual MATLAB and Qt captures and the same-input numerical comparison.

  5. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_mffimport layout finding is tracked in #1030. PR #1029 includes the actual MATLAB and Qt captures and the same-input numerical comparison.

  6. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_taskinfo GUI finding is tracked in #1049. PR #1048 includes the captures and numerical measurements.

  7. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_eventinfo GUI finding is tracked in #1051. PR #1050 includes the captures and numerical measurements.

  8. arnodelorme commented on Dec 1, 2026

    @arnodelorme
    Collaborator

    🤖 The new pop_participantinfo GUI finding is tracked in #1053. PR #1052 includes the captures and numerical measurements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions