Repository navigation
Fix File menu and data I/O audit findings (#673) - #676
Conversation
Save datasets atomically, write EEGLAB MATLAB v6 study files, keep BIDS imports out of the raw folder, and align the File-menu importers, export, and study dialogs with the Nov 23, 2026 audit. Co-authored-by: Suraj Ranganath <[email protected]>
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.
Code review
BlockingNone. Important
Nits
Test gaps
EEGLAB parity notesNone beyond the differences the PR already documents. |
|
|
||
| def _looks_segmented(path: Path) -> bool: | ||
| folder = path if path.is_dir() else path.parent | ||
| return any(folder.glob("Categories*")) or any(folder.glob("epochs*")) |
There was a problem hiding this comment.
Blocking: every MFF is treated as segmented. Continuous MFF recordings also contain epochs.xml, one entry per recording block. Because of that, folder.glob("epochs*") matches every .mff folder. Continuous files then go through mne.read_epochs_egi instead of read_raw_egi, and they either fail or import as the wrong kind of dataset.
eegprep/src/eegprep/functions/popfunc/pop_mffimport.py
Lines 76 to 79 in daa3aeb
Fix: base the check on categories.xml only. pop_mffimport.m creates epochs only when categories exist.
| return any(folder.glob("Categories*")) or any(folder.glob("epochs*")) | |
| return (folder / "categories.xml").is_file() |
There is no testmff.mff fixture in the tree. Even a small synthetic folder with only the XML files would lock this branch with a test.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. _looks_segmented now looks only for categories.xml or Categories.xml. A folder that has epochs.xml and no categories file stays continuous. test_mff_segmentation_follows_categories_not_epochs_xml builds that folder.
| for index, row in enumerate(np.asarray(epochs.events)): | ||
| event = { | ||
| "type": str(row[2]), | ||
| "latency": float(index * epochs.times.size + row[0] + 1), |
There was a problem hiding this comment.
Important: epoch event latencies are wrong. For MNE Epochs, events[:, 0] is the absolute sample in the original continuous recording, not an offset inside the epoch. So index * pnts + row[0] + 1 can exceed pnts * trials, and eeg_checkset will drop or reject these events.
eegprep/src/eegprep/functions/popfunc/pop_mffimport.py
Lines 108 to 114 in daa3aeb
Fix: put the time-locking event at the zero-time sample of each epoch, which is the EEGLAB convention for epoched latencies.
| "latency": float(index * epochs.times.size + row[0] + 1), | |
| "latency": float(index * epochs.times.size + int(np.argmin(np.abs(epochs.times))) + 1), |
There was a problem hiding this comment.
🤖 Fixed in 34ab759. Epoch events are placed at the zero-time sample of each epoch (argmin(abs(times))), not at events[:, 0]. The same test checks a time axis of [-0.1, 0, 0.1] and an event sample of 5000, and expects latency 2.
| result = inputgui(pop_mffimport_dialog_spec(), renderer=renderer) | ||
| if not result: | ||
| return ({}, "") if return_com else {} | ||
| try: | ||
| import mne | ||
| except ImportError as exc: | ||
| raise ValueError( | ||
| "pop_mffimport: MNE is required to read EGI MFF. Install it with `uv sync --group dev`, then import again." |
There was a problem hiding this comment.
Important: two problems in this block.
- The
typefieldchoice from the dialog is thrown away.resultis only checked for Cancel, so pickinglabelormffkeyshas no effect. Either use it to choose the event type (_epoch_events/mne_raw_to_eeg) and record it in the history command, or remove the dialog. mneis theeegprep[mne]extra, but the error tells pip users to runuv sync --group dev. Use the shared helper, aspop_fileio.py:152does, so the message names the right extra:
mne = import_optional_dependency("mne", feature="pop_mffimport")That also removes the local try/import.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. The dialog choice is typefield code, label, or mffkeys. It is a real argument, it selects the epoch event type, and the history command records it. MNE is loaded with import_optional_dependency("mne", feature="pop_mffimport"), so a missing install names eegprep[mne].
| ): | ||
| text = str(result.get(tag) or "").strip() | ||
| if text: | ||
| ranges[key] = text |
There was a problem hiding this comment.
Important: dialog subsets crash loadeeg. The edit-box text goes in unparsed. loadeeg._one_based_indices runs np.asarray(value, dtype=float), so input like 1 2 3 or 1:10 raises ValueError: could not convert string to float. Only a single number works.
eegprep/src/eegprep/functions/sigprocfunc/loadeeg.py
Lines 209 to 213 in daa3aeb
Fix: parse the text the same way pop_fileio does: ranges[key] = parse_numeric_sequence(text, dtype=int), imported from _pop_utils.
Related: the history at L84 is always pop_loadeeg(path), and pop_loadeeg takes no subset or precision kwargs. A GUI import that uses subsets therefore can't be replayed. Add the options to the signature and write them into the command.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. Subset text goes through parse_numeric_sequence, so 1:3 and 1 2 become integer lists before loadeeg. pop_loadeeg now takes triallist, typerange, chanlist, responsetype, and format, and the history command includes the ones that were set. test_pop_loadeeg_parses_subset_text_into_replayable_history covers the parse.
| relative = resolved.relative_to(parent) | ||
| except ValueError: | ||
| return None | ||
| if relative.parts and relative.parts[0] == "derivatives": |
There was a problem hiding this comment.
Important: resaving inside a derivatives pipeline is refused. BIDS derivative folders have their own dataset_description.json. For example, bids_preproc writes derivatives/eegprep/dataset_description.json (bids_preproc.py:1255).
Take derivatives/eegprep/sub-01/eeg/x.set. The loop stops at derivatives/eegprep, relative.parts[0] is sub-01, and that folder is returned as a raw root. File > Save then refuses a file that is already a derivative.
eegprep/src/eegprep/functions/popfunc/pop_saveset.py
Lines 651 to 667 in daa3aeb
Fix: return None when any ancestor is named derivatives, or when the found description has "DatasetType": "derivative". Add a test that resaves a file under derivatives/<pipeline>/ with its own description present.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. raw_bids_root returns no raw root when the path has a derivatives ancestor or the description it finds has DatasetType: derivative. A resave under derivatives/eegprep/ with its own description is allowed. test_derivative_dataset_can_be_resaved writes that layout and resaves. A file in the raw BIDS folder is still refused.
| _write_study(path, study, fileformat) | ||
| command = build_matlab_call( | ||
| ("STUDY", "ALLEEG"), | ||
| "pop_savestudy", |
There was a problem hiding this comment.
Important: replaying this history in the console overwrites ALLEEG with a string. The command is now [STUDY ALLEEG] = pop_savestudy(...), which the console translates to STUDY, ALLEEG = pop_savestudy(...).
pop_savestudy returns (study, command). _extract_pop_study_state turns that into a ConsoleStudyResult with includes_alleeg=False, whose __iter__ yields (study, command). The replay therefore sets ALLEEG to the history string.
eegprep/src/eegprep/functions/adminfunc/console.py
Lines 161 to 166 in daa3aeb
Fix: either keep the target as ("STUDY",), or have pop_savestudy return (study, ALLEEG, command). test_matlab_study_history_is_console_replayable only runs ast.parse on an std_editset line. Extend it to run the pop_savestudy command through the console and assert that ALLEEG is still a list.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. return_com=True now returns (study, datasets, command). The console study result therefore yields the dataset list as ALLEEG instead of the history string. Callers that unpacked two values were updated. test_pop_savestudy_replay_keeps_alleeg_as_datasets runs the command in the console and checks that ALLEEG is still a list of datasets.
| { | ||
| "bids_field": bids_field, | ||
| "eeglab_field": eeglab_field, | ||
| "Levels": "", |
There was a problem hiding this comment.
Important: reopening Event info erases saved Levels, LongName, and Units. The table always starts with blank Levels, LongName, and Units. When the user presses Ok, _event_field_map builds a new dict per field, and .update(metadata) replaces the stored dict, so values entered earlier are lost.
Fix: when current is a dict, prefill every column from it, e.g. "Levels": str(current.get("Levels") or ""). Levels is a dict in BIDS, so it needs a round-trippable text form. Do the same for LongName and Units, and add a test that opens the table twice.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. Reopening the event table prefills Levels, LongName, Description, and Units from the stored field. Levels of the form 1=rare is stored as a dict and shown again as 1=rare. test_event_info_reopen_keeps_levels_longname_and_units writes the row, rebuilds the table rows, and writes them back.
| datasets = [] | ||
| task = "eeg" | ||
| for entry in entries: | ||
| dataset = pop_loadset(str(entry["file"])) |
There was a problem hiding this comment.
Important: the wizard cannot read raw files. The welcome page says "Continue to choose raw files", but every grid row is loaded with pop_loadset, which only reads .set files. An .edf, .bdf, or .vhdr row fails with "not a valid EEG .set dataset". EEGLAB's bids_exporter.m exists to convert raw recordings.
Fix: dispatch by extension to the existing importers (pop_biosig, pop_loadbv, pop_fileio), the same way MenuActionDispatcher._import_dataset does. If that is out of scope, change the welcome text and grid label to say .set files.
There was a problem hiding this comment.
🤖 Fixed in 34ab759. The wizard loads .edf, .bdf, and .gdf with pop_biosig, BrainVision .vhdr with pop_loadbv, .set with pop_loadset, and anything else with pop_fileio. test_bids_wizard_sends_edf_to_pop_biosig checks that an .edf row reaches pop_biosig.
Segment MFF only when categories exist, keep epoch events at time zero, and let study-history replay leave ALLEEG as datasets. Derivative BIDS folders can be resaved, and the export wizard reads raw recordings. Co-authored-by: Suraj Ranganath <[email protected]>
A MATLAB study stores cluster sets as a matrix with one column per component. Flattening that matrix made pop_clust reject the parent cluster. Also declare the MFF importer's MNE extra and narrow the Neuroscan import result for the type checker. Co-authored-by: Suraj Ranganath <[email protected]>
Keep a (2, 1) cluster sets matrix, add one to CNT event latency, and epoch segmented MFF from categories.xml. Study and BIDS history now replays in EEGLAB, including per-file tasks, shared events.json, and MATLAB expression rules. Co-authored-by: Suraj Ranganath <[email protected]>
|
🤖 Follow-up at
The eight earlier inline threads already have replies. CI on |
A folder import returns STUDY and ALLEEG. The gallery example still indexed that pair as a dataset, which failed the docs build. Co-authored-by: Suraj Ranganath <[email protected]>
|
🤖 Docs build failed at |
Ruff format rejects the wrapped ternary in the synthetic CNT writer. Co-authored-by: Suraj Ranganath <[email protected]>
|
🤖 Ruff format failed at |
Segmented MFF uses the XML time unit, microvolts, epoch xmin, and event tracks. Cluster sets stay numeric matrices, and the v7.3 writer uses a MATLAB header and unique #refs#. ERP loads no longer insert the same file twice. BIDS events.json is at the dataset root, power-line frequency is numeric, and the export grid pages. Co-authored-by: Suraj Ranganath <[email protected]>
|
🤖 Round 3 is
|
Epoch and category times without a unit are microseconds, matching mff_import.m on EEGLAB's testmff.mff. The v7.3 study header is version 0x0200 and object references point at #refs# datasets. Participant-info history is the interactive EEGLAB line, and weighted-column labels no longer force every dialog wider. Co-authored-by: Suraj Ranganath <[email protected]>
Windows denies the replace while the .fdt is still memory-mapped, so resaving that dataset to the same file failed in CI. Co-authored-by: Suraj Ranganath <[email protected]>
|
🤖 Round 4 is on
Windows also failed |
Char and empty MATLAB values now use fixed-length class names, uint64 empty dimensions, and UTF-16 decode flags. MFF events keep file order, datenum latencies, and the EEGLAB key fields. Co-authored-by: Suraj Ranganath <[email protected]>
The Qt renderer reads a button key that the Clear callbacks omitted. Clock latency is the exact microsecond difference, and a 1-D empty MATLAB array is stored as 0-by-0 without MATLAB_int_decode on an empty char. Co-authored-by: Suraj Ranganath <[email protected]>
mffkeys keeps the space after each colon. The study wizard is 1186 by 500 so Clear stays in view, the BIDS welcome button fits Continue, and later export pages number rows from 11. Co-authored-by: Suraj Ranganath <[email protected]>
The 1186 by 500 dialog scrolls vertically so Ok stays reachable, and a read-only BIDS import reports pop_importbids from the filesystem error. Co-authored-by: Suraj Ranganath <[email protected]>
Read-only saves again say which function failed and to choose a writable path. The wizard scroller fills the 500 px dialog, so row 10 stays on screen and a long file list still scrolls. Co-authored-by: Suraj Ranganath <[email protected]>
Dialog buttons grow to their text when a fixed size would clip. Empty channel coordinates export as n/a. A read-only study save reports permission denied on the path. Co-authored-by: Suraj Ranganath <[email protected]>
|
claude review this |
| return_com=True, | ||
| ) | ||
| self.session.echo_command(command) | ||
| self.session.set_study(study, command=command) |
There was a problem hiding this comment.
Important: pop_savestudy resaves deep copies of the datasets and returns them as _datasets. This line drops them, so after the user answers "Yes", session.ALLEEG still has saved == "no" and the old filename. The next Save study prompts again, and Quit treats the datasets as unsaved.
| self.session.set_study(study, command=command) | |
| self.session.set_study(study, _datasets if resavedatasets == "on" else None, command=command) |
See
eegprep/src/eegprep/functions/studyfunc/pop_savestudy.py
Lines 60 to 66 in 468b0eb
There was a problem hiding this comment.
🤖 Save study now keeps the datasets pop_savestudy returns when the user chooses Yes: self.session.set_study(study, _datasets if resavedatasets == "on" else None, command=command). A dataset with saved='no' becomes saved='yes' with its filename and filepath updated, and a second Save study does not ask again.
| "Use File > Save current dataset as, then quit again.", | ||
| ) | ||
| return | ||
| pop_saveset(eeg, target) |
There was a problem hiding this comment.
Important: This call passes an explicit filename and no savemode, so the new raw-BIDS guard never runs. _refuse_raw_bids_resave only runs for savemode == 'resave':
eegprep/src/eegprep/functions/popfunc/pop_saveset.py
Lines 648 to 668 in 468b0eb
A raw BIDS dataset stored as .set under sub-*/eeg/ that was edited and then saved from Quit → "Yes" is overwritten in place.
Fix: call pop_saveset(eeg, savemode="resave"). Catch the ValueError, show it with self._warn(parent, str(exc)), and return without closing.
There was a problem hiding this comment.
🤖 Quit → Yes now calls pop_saveset(eeg, savemode="resave"). A ValueError is shown with _warn and the window stays open. Study resave calls pop_saveset(eeg, path, savemode="resave"), so _refuse_raw_bids_resave runs. Quit → Yes on an edited raw-BIDS .set leaves the bytes and mtime unchanged and the warning names the refusal. pop_savestudy(..., resavedatasets='on') on a raw-BIDS dataset raises that refusal.
| os.remove(file_name) | ||
| scipy.io.savemat(set_tmp, eeglab_dict, appendmat=False, long_field_names=True) | ||
| if save_two_files: | ||
| with _unlocked_sidecar(data_value, fdt_final): |
There was a problem hiding this comment.
Important: close_file() calls array._mmap.close() directly. If any NumPy view of the mapped data is still alive, CPython raises BufferError: cannot close exported pointers exist. Common cases are x = EEG['data'][0] in eegprep-console and a plot that still holds a slice. The resave then fails with "could not write …", although it worked on Linux and macOS before this change. MemmapData.close() explains this hazard:
eegprep/src/eegprep/functions/adminfunc/storage.py
Lines 209 to 236 in 468b0eb
Fix: force-close the handle only on Windows (os.name == "nt"). Elsewhere, use close(). Alternatively, convert BufferError into a pop_saveset error that says how to fix it. Add a test that holds a view and then resaves.
There was a problem hiding this comment.
🤖 Resave no longer calls close_file() under a live view. On POSIX it uses data.close() and os.replace, so the old inode stays valid for existing slices. On Windows it unmaps only when nothing else holds the mapping; if a plot or the console still has a view, pop_saveset refuses and says to close those references or Save as a new file. A resave with no live view still replaces the .fdt. Holding view = np.asarray(eeg['data'])[0] through a same-path resave keeps the view values, and reloading the new .fdt matches the data written at save time. On Windows that live-view resave raises the refusal instead.
…682. Co-authored-by: Suraj Ranganath <[email protected]>
Save study stores the datasets pop_savestudy returns. Quit and study resave use savemode=resave, so a raw BIDS .set is refused. POSIX resave releases the memmap handle without closing it under a live view; Windows refuses that resave instead of unmapping. Co-authored-by: Suraj Ranganath <[email protected]>
Keep the #675 Edit and Tools changelog bullet beside the #673 file-menu bullet. Dialog buttons keep OK as the default button and still grow to the label size hint. Co-authored-by: Suraj Ranganath <[email protected]>
|
Claude finished @suraj-ranganath's task in 1m 44s —— View job Code review
BlockingNone. Important
Nits
Test gaps
EEGLAB parity notesNone beyond the differences the PR already documents (quit prompt, Re-checked at
|
| if not path.is_absolute(): | ||
| path = Path(filepath) / path.name | ||
| pop_saveset(eeg, path) | ||
| pop_saveset(eeg, path, savemode="resave") |
There was a problem hiding this comment.
Important: _resave_datasets rewrites every dataset in the study, including unmodified ones. Now that this call uses savemode="resave", the raw-BIDS refusal applies to all of them. In a study that holds an unmodified raw-BIDS .set plus one edited dataset, Save study → "Yes" raises the refusal and saves nothing. Unchanged sidecars are also rewritten for no reason.
eegprep/src/eegprep/functions/studyfunc/pop_savestudy.py
Lines 403 to 422 in 814375f
In pop_savestudy.m, as I remember it, only datasets with saved equal to 'no' are resaved. The EEGLAB source is not vendored in this checkout, so I could not check the line. The menu asks this question only when some dataset has saved == "no".
Fix: at the top of the loop, skip datasets whose saved is not "no", as in if eeg.get("saved") != "no": continue. Add a test with one clean raw-BIDS dataset and one modified derivative dataset. With resavedatasets='on', the study should save, and the raw file's mtime should not change.
Skip datasets whose saved flag is 'yes' or 'justloaded' so one clean raw-BIDS dataset no longer blocks Save study, while a modified raw-BIDS dataset is still refused.
|
Replies to the review on 814375f, fixed at a7cc1b2: Dataset resaving (4675467575). Fixed. Scripts and File > Save current study > Yes now write only datasets marked Difference from EEGLAB: Packaged help.
Local checks: pre-commit, ruff format, ty, and 382 tests across the study, file menu, console, GUI and BIDS export modules passed; the group-analysis example ran end to end. |
|
Claude finished @suraj-ranganath's task in 24s —— View job Review skippedI did not run a new review on
To get a review of the fixes in |
Code review
BlockingNone. Important
Nits
Test gapsNone. EEGLAB parity notesNone beyond the nit above. The prompt condition matches |
|
Both points from the last review are handled at bd045f8.
|
Fixes #673
File-menu and data I/O fixes from the Nov 23, 2026 side-by-side audit against EEGLAB
8ac485f6. The final head isbd045f8b.EEGLAB reference suite
The MATLAB reference workflow ran on
d37522c2in 29m 13s, using EEGLABd0963be9d81acc5b66e84f8d3d7c89e3ce127cc4and eeglab_testsfec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. Across seven jobs, 4,424 tests passed, 5 failed and 58 were skipped. The only differences between the tested tree and the final head are the documentation edits described below. Reference run 45444166424All five failures are tracked on
develop. The failing assertions and reported values match the run on PR #672. After fetchingorigin/develop,git diff --name-only origin/develop...HEADshowed no changes to the failing tests or the implementations responsible for those assertions. Issue #685 · PR #672 reference runtest_coregister_traditional_warp_matches_eeglabtest_synthetic_traditional_warp_matches_fieldtriptest_bem_leadfield_and_multifit_match_fieldtriptest_matlab_kmeans_numbering_matches_fixed_initial_centroids[1, 2, 1, 1, 2, 2], and the test expected[2, 3, 2, 2, 3, 3].test_struct_near_assertion_matches_sourcenear.mreturned false for a pair that Python'sassert_matlab_struct_nearaccepted. The expectedAssertionErrorwas never raised.Of the 58 skips, 36 required
--run-heavy-referencein their job. Eight needed BioSig'sopenbdf, three needed Neuroscan I/O, two needed ERPSS and three needed a working AMICA binary. Two BIDS tests require specific hosts, two dependency checks cover packages outside eegprep-lean, one path test requires Windows and onepop_chaneditmenu lookup requires an interactive session.Save current study (
a7cc1b28)File > Save current study > Yes and scripts using
resavedatasets='on'write only datasets markedsaved='no'. Each successful save marks the dataset'yes'in the returnedALLEEG. Tests reload an edited derivative and verify that a clean raw BIDS recording keeps its bytes and modification time for both'yes'and'justloaded'. Attempting to overwrite a modified raw recording still raises an error.pop_savestudyand its callers dropped the unusedreturn_comoption. The function always returns(study, datasets, command). The console test saves a real study and checks the synchronized datasets and command history. The packaged help inpop_savestudy.mdand the workflow guide show the three-value return, MATLAB v6 output, the v7.3 size fallback and optional JSON. They also explain thatstd_rmalldatafieldsremoves cached measures from the disk copy while the returned STUDY keeps them.Merge from develop (
d37522c2)The branch merged
developat0641c239and restored the changelog entries ind37522c2. The only conflict was indocs/source/changelog.rst. The resolution retains the File menu and data I/O entry (#673), the BIDS updates, the pAMICA reference (#674) and the topoplot entry (#670).Study resave documentation (
bd045f8b)EEGLAB resaves a dataset marked
saved='justloaded'during a study save. EEGPrep skips it because the dataset has not changed since loading. Thepop_savestudyfunction notes, packaged help and study workflow guide now document this difference. On this head, all 90 file-menu audit and study metadata tests passed in 4.46s../pre-commit.py --all-filespassed on 1,474 files. EEGLAB pop_saveset.m, line 175Root causes that differed from the issue
loadcnt()stores the same 0-based sample offset as MATLABloadcnt.pop_loadcntadds 1, matchingpop_loadcnt.mline 152. Duration stays unset so a leading boundary is kept. CNT length is not extended by EEGLAB's three tail samples.option_saveversion6, EEGLAB writes MAT v6 and falls back to v7.3 when that file is too large. Precomputed measures are stripped on disk withstd_rmalldatafieldsand kept on the returned STUDY. Resaving a JSON.studywrites MATLAB. The return is always(study, datasets, command).roundis MATLAB half-away-from-zero,bitandcasts float operands,1<X<3evaluates left to right, and~is logical not. Errors name the user's expression.[STUDY ALLEEG] = pop_importbids(...)with noreturn_studyoption. A recording that has noses-folder is written undersub-<label>/eeg. A folder import returns(STUDY, ALLEEG).pop_savestudyhistory namesALLEEG, as this issue asks.pop_savestudy.minterpolatesEEG.option_singleis not applied. Datasets stay float64.Second review
setsof shape(2, 1)stay 2-D. Onlycompsis flattened.read_raw_egiand split fromcategories.xml/epochs.xml.pop_loadeeghistory is positional and events are ordered by latency.pop_studyerpbrowses per dataset and orders conditions on the outside.pop_studywizardrecords the grid fields.task-<task>_events.json, useschanlocs.type, and keeps one task per wizard file._acq-coordsystem names are allowed.pop_runscriptvalidates every line before running any of them. Quit still asks before discarding unsaved data; that difference fromeeglab.mline 619 is documented.Third review
cluster.setsis saved as a numeric matrix. scipy.loadmat keeps shapes(2, 1)and(2, 2).0x0200in the fourth review. A 2-dataset study with a design reloads in Python. The fifth review records the later MATLABload('-mat')check.pop_studyerpandpop_studywizarddo not preload files. A 2x2 ERP grid yields four datasets,(S01,A),(S01,B),(S02,A),(S02,B). Using one file twice raises the duplicate-dataset error.pop_loadeeghistory ends the folder with a file separator.round(X)==-3,>=,<=, and~=still update the channel.pop_chanevent.mline 225 does not. That difference is documented.bitandon a negative or non-integer channel raises an error that namespop_chanevent. EEGLAB also rejectsbitand(abs(round(X)),1)on single-precisionEEG.data.task-<task>_events.jsonis written at the dataset root. Power-line frequency is a number when one is supplied, andn/aotherwise.<>paging. Buttons are Help, Cancel, Ok.Fourth review
tests/fixtures/testmff.mffis EEGLABsample_data/test_data/testmff.mffat8ac485f6, andtest_real_testmff_matches_eeglab_epochsimports it. Shape(257, 300, 2), max abs19.749, xmin-0.202002, 10 events including the per-trialULRNandLRNDevents, track durations1000samples, andEEG.epochfromeeg_checkset.00 02 IM. Structs are groups. Cell arrays and struct-array fields are object references into#refs#. A(2, 1)setsreloads as(2, 1). The fifth review records the later MATLABload('-mat')check. The test writespair.studyunder pytest's tmp path. With--basetemp=/tmp/eegprep-v73-pairthe file was/tmp/eegprep-v73-pair/test_v73_study_with_two_datase0/pair.study.[EEG, STUDY, command] = pop_participantinfo(EEG, STUDY);. EEGLAB is interactive-only. EEGPrep'srowsargument still scripts the table.pop_chaneventwraps the long labels. Dialog width is 720 px.test_f89_default_options_are_visible_without_scrollingpasses..fdtcloses that mapping before the replace. Windows denied the replace while the file was still mapped.Fifth review
At
d64e7f8b. The sixth review replaces the clock-latency, empty-array, andCLearnotes.MATLAB_classis a fixed-length ASCII scalar (|S4'char',|S6'double','struct', and so on), not an HDF5 vlen string. Char data stays uint16 UTF-16-LE. A non-empty char carriesMATLAB_int_decodeas int322.testmff.mffthe first three types arestm+,LRND,LRND.pop_mffimportreturnseeg_checksetdirectly. The comments that namedtestmff.mffare gone.os.replace.gc.collect()is gone. The Linux resave test passes. Windows CI is the lock check.MATLAB check for the v7.3 study
MATLAB R2025b on jamming already loaded this v7.3 STUDY (
load -mat,pop_loadstudywith real datasets,std_checkset, and resave). The snippet below is the check that was used.nameis'Pair',filenameis'pair.study', andnotesis''.uv run pytest tests/test_file_menu_audit_673.py::test_v73_study_with_two_datasets_and_a_design_reloads --basetemp=/tmp/eegprep-v73-pairA later complaint that
s01.setis missing is separate fromCannot read file/STUDY set file 'STUDYfile' not loaded.Sixth review
Verified on MATLAB R2025b: the v7.3 STUDY loads, the exact MFF latency is 50.99 samples, and
pop_studywizardopens. The seventh review corrects themffkeysspacing below.pop_studywizard(gui=True)and the BIDS export grid open in the real Qt renderer. Each Clear callback sets"button": f"clear{index}", whichqt.pyreads when it connectsclear_widgets.test_wizard_dialogs_open_in_the_qt_rendererbuilds both dialogs offscreen and clicks Clear.beginTimeandrecordTime, timessrate. The firststm+ontestmff.mffis 203960 microseconds, which is 50.99 samples at 250 Hz. The first epocheventlatencyis -2.042 ms. EEGLAB reports 50.990568 becausemff_decodetime.muses1.15251e-11days per microsecond (0.42% below1e-6/86400) and MATLAB's stringdatenummis-parses the timestamp by 0.16 to 2.44 microseconds. EEGPrep does not copy either error. The migration notes,storage.rst, andpop_mffimporthelp say this.classidisEVNTwhen a track event's XML omits it (Event.getClassID()). Category segments keep the<seg status="...">attribute, and track events carrystatusas well.Clear.pop_studywizard.mwritesCLear;superguirecapitalises it. Both wizard grids show abrowseheader, row numbers, and no header over Clear. The BIDS welcome button isContinue, with thebids_exporter.mtext.np.array([]), the shape ofcache,changrp,group,run, andsession) is stored as uint64[0 0], so MATLAB reads 0-by-0. An empty char hasMATLAB_emptyand does not haveMATLAB_int_decode. A non-empty char still has int322. MATLAB R2025b confirmed the v7.3 load.pop_chaneventuses the 10-rowpop_chanevent.mgeometry, including the two spacer rows and(set = yes)besideDelete event channel(s)?.savedagain in_apply_save_metadata;pop_savesetandmark_current_savedalready do. The migration notes say a BIDS folder import writes the derivative.setfiles and the.studyfile to disk underderivatives/eeglab.Seventh review
mffkeysmatches EEGLAB'schar(keylist), including the space after each colon (character codes 35, 58, 32, 49). The first stimulus is[cel#: 1, obs#: 3, pos#: 3, argu: 0]. Category events use the same text, for example[#seg: 15, subj: ...].mffkeysbackupandclassidset to''. Track events still useEVNTwhen the XML omitsclassid.pop_studywizardis 1186 by 500, the EEGLAB dialog size. The eighth review keeps that size when many files are selected.Continuebutton is 110 px wide, so the label is not clipped to:ontinue. The test checks that the button's contents are at least as wide as the text.derivatives/eeglabraisespop_importbidsand tells you to copy the dataset to a writable folder. The migration notes name DataLad and OpenNeuro mounts as that case.Eighth review
pop_importbidserror from the filesystemOSError. The ninth review restores the wrappedpop_savesetandpop_savestudymessages.Ninth review
.setor a.studyinto a directory mode0o555again raisescould not writeand tells you to choose a writable path. The import path rewraps thatValueErroronly when its cause is anOSError, so a read-only BIDS import still says to copy the dataset to a writable folder.Tenth review
(1, 0)X/Y/Z arrays oneeglab_data_epochs_ica.set, are missing.electrodes.tsvwritesn/afor those cells, the same token EEGLAB'sbids_writeelectrodefileuses when X is empty.scipy.io.savematrewrites a failed open of a path that is not a string as "Reader needs file name or open file-like object", hiding the permission error. The study writer passes a string path, so a read-only save says permission denied on that path inside the existing could-not-write message.Eleventh review
developat7e17c302. The Unreleased changelog keeps the GUI audit Nov 23: File menu and data I/O fixes (BIDS resave overwrite, .study format, text export, importers, BIDS tools) #673 File menu bullet and the [ICA] Record pAMICA rejection with EEGLAB defaults #674 pAMICA bullet.-0.000000. Missing coordinates stayn/a.channels.tsvandevents.tsvdo not use that fixed format in EEG-BIDS: channels are text, and event onset and duration use 10 significant digits, which the existing writer already follows.Twelfth review
electrodes.tsvuses LF. The other export TSVs already did. JSON sidecars, README, CHANGES, and the preprocessing TSV and JSON writers open with an LF newline, so Windows does not turn those files into CRLF. The electrode test compares the file bytes, and the same export checks channels, events, and participants the same way.Thirteenth review
developata010da1c([CI] Keep other PR comments from cancelling a Claude review #682) so.github/workflows/claude-code-review.ymlmatches.pop_savestudyreturns when resave is on. The resaved dataset issaved='yes'with its filename and filepath, and a second Save study does not ask.pop_savesetwithsavemode='resave'. When a modified raw BIDS.setwould be overwritten, the file keeps its bytes and mtime, the warning explains the refusal, and the window stays open..fdtresave on POSIX drops the memmap handle withclose()and replaces the file, so a live array view keeps its values. Windows unmaps only when no view is held; otherwisepop_savesetrefuses and says to close the plot or console reference, or Save as a new file.Fourteenth review
developatf6bea53c([eegprep-lean] Set chanlocs type from the Zarr group's channel_type #669 and Fix Edit and Tools audit findings (#675) #677). The conflicts weredocs/source/changelog.rstandsrc/eegprep/functions/guifunc/qt.py. Both Unreleased bullets stay. Dialog buttons keep OK as the default button and still grow to the label size hint.menu_actions.pyauto-merged with the resaved study datasets andpop_editset(..., alleeg=ALLEEG).Checklist
derivatives/eeglaband refuses a raw-folder resave.pop_chaneventnumeric edges, leading default, and MATLAB expression rules..set/.fdtreplace; a failed save leaves the original..studyas MATLAB.loadcntoffset plus 1, with no duration..eegimports throughpop_loadeegwith positional history and latency order..mffimports throughpop_mffimportusingread_raw_egiplus category segments.rowsscripts the table in EEGPrep.task-<task>_events.jsonand channel type fromchanlocs.type.validate_bidsflagsrun-,task-,desc-, andrec-on coordsystem names.acq-is allowed.std_editsetand keeps the grid fields.pop_runscriptchecks every.mline before running any of them.pop_saveh(EEG.history, ...).pop_loadset('filename', ..., 'filepath', ...).pop_newset.option_singlestaying float64..mathistory ispop_loadbva.dataformat.Earlier local verification
tests/test_file_menu_audit_673.py(64 tests),tests/test_pop_saveset.py,tests/test_study_metadata.py,tests/test_file_menu_pop_functions.py,tests/test_storage.py, andtests/test_gui_pop_study.pypassed locally (132)../pre-commit.py --all-filespassed.uv run ruff format --check .passed.uv run ruff check .passed. An earlier MATLAB R2025b check loaded the v7.3 study, verified the 50.99-sample latency and opened the study wizard.After the
f6bea53cmerge, 602 file-menu, save, study and Edit/Tools tests passed and 12 were skipped.tests/test_pop_select.py::TestPopSelectParity::test_parity_trial_subsetfailed because this environment has no EEGLAB checkout../pre-commit.py --all-filespassed.uv run ruff format --check .passed.The diff against
developcontains no changes totests/fuzz/tolerances.toml, goldens or parity JSON files.