Repository navigation
Description
The EEGLAB reference workflow fails 5 tests on current develop code. They showed up in run https://github.com/sccn/eegprep/actions/runs/45309848204, which was dispatched on the #677 branch at 5e24e40 (develop 7e17c30 merged in; EEGLAB d0963be9, eeglab_tests fec88f9f). #677 does not cause them. They need a root-cause fix on develop.
Evidence that they come from develop
- For the coregister and BEM tests, the Python side gives bit-identical results on develop 7e17c30 and on the Fix Edit and Tools audit findings (#675) #677 head. The checks were
coregister(...)onstandard_1005.elcandstandard-10-5-cap385.elp, the syntheticwarp_optim, andbem_parity_payload(sample_data/eeglab_data_epochs_ica.set). - Fix Edit and Tools audit findings (#675) #677 does not touch any of these tests,
tests/eeglab_tests/,tests/matlab_batch_engine.py, the MATLAB output transport,_coordinates.warp_optim, or the study clustering code. - The last reference run on develop-based code, https://github.com/sccn/eegprep/actions/runs/44293705857 at d0dea04 (Nov 18), passed the study shard. Its core shard had one failure, a marginal
test_bem_leadfield_and_multifit_match_fieldtripRV gap (0.0087854 vs 0.0087186), and the dipole positions were within 1 mm.
Failures
1. tests/test_coregister_parity.py::test_coregister_traditional_warp_matches_eeglab (core shard)
Not equal to tolerance rtol=0.0001, atol=0.001
Mismatched elements: 1 / 9
Max absolute difference among violations: 0.00384488
ACTUAL: [ 0.4963292, -17.22933, 2.238271, 0.1025683, 0.004959405, -1.574362, 1.155484, 1.065086, 1.159642]
DESIRED: [ 0.4924843, -17.22919, 2.237454, 0.1025734, 0.004982652, -1.574385, 1.155491, 1.065104, 1.159653]
On standard_1005.elc the Python transform is [0.496325, -17.229321, 2.238268, 0.102568, 0.004959, -1.574363, 1.155484, 1.065086, 1.159642] on both commits.
2. tests/test_coregister_parity.py::test_synthetic_traditional_warp_matches_fieldtrip (core shard)
Mismatched elements: 7 / 9
Max absolute difference among violations: 1.38408718
ACTUAL: [5, -3, 2, 2.864785, -2.291825, 1.71888, 2, 1.5, 1.200001]
DESIRED: [4.992872, -3.000655, 1.997129, 2.911925, -2.291934, 0.334793, 2.00154, 1.504206, 1.1929]
Python recovers the true parameters exactly on both commits. The MATLAB reference does not converge to them: its z rotation is 0.33 where the truth is 1.72.
3. tests/test_dipfit_bem.py::test_bem_leadfield_and_multifit_match_fieldtrip (core shard)
assert np.all(distances < 1.0)
distances = [3.41e-05, 6.19e-05, 7.9456]
On both commits the Python positions are [[2.2411, 23.7569, -3.7978], [47.4298, -34.9834, 7.9], [6.5582, 66.1335, -22.0314]] and the RVs are [0.02535647, 0.04678615, 0.00942621]. The component 3 dipole is now 7.9 mm from the MATLAB one. On Nov 18 it was within 1 mm.
4. tests/test_study_clustering.py::test_matlab_kmeans_numbering_matches_fixed_initial_centroids (core shard)
Arrays are not equal
ACTUAL: [1, 2, 1, 1, 2, 2]
DESIRED: [2, 3, 2, 2, 3, 3]
The test skips when Statistics Toolbox kmeans is not on the path. Check whether the Nov 18 run actually ran it before treating this as a regression. The labels are off by exactly one, which points to 0-based vs 1-based indexing in how labels cross the transport or in the test's expected values.
5. tests/test_phase2_file_channel_location.py::test_struct_near_assertion_matches_source (study shard)
with pytest.raises(AssertionError):
Failed: DID NOT RAISE <class 'AssertionError'>
For one of the cases in the test, MATLAB near.m returned false while assert_matlab_struct_near accepted the pair. Without MATLAB, the Python helper calls cases 0, 1, 3, 8, 9, 11 and 12 near, so the disagreeing case is one of those. Candidates are the transposed struct (1), the NaN/Inf row (11) and the cell case (12). The struct and cell shaping changed in the transport.
Suspected causes
- MATLAB transport changes after the Nov 18 pass: Shape MATLAB outputs at the transport boundary #657 (shape MATLAB outputs at the transport boundary), Clear Python-backend xfails at the root and the MATLAB transport #658 (clear Python-backend xfails at the root and the MATLAB transport) and Clear the last Python-backend xfails #659. These fit failures 4 and 5, and possibly the reference payloads in 1 to 3.
- [DIPFIT] Match FieldTrip fminunc dipole fits on BESA and MNI #666 (FieldTrip fminunc parity, merged Nov 22 as 6b8012c) changed the shared fminunc used by the DIPFIT fit and the coregister warp. This fits failures 1 to 3. Check it against the MATLAB
eegprep_coregister_parity,eegprep_warp_optim_parityandeegprep_dipfit_bem_referencehelpers.
How to reproduce
- In CI: dispatch
.github/workflows/eeglab-reference.ymlon develop. Failures 1 to 4 are in the core shard and failure 5 is in the study shard. - Locally, with real MATLAB:
uv run --no-sync pytest tests/test_coregister_parity.py tests/test_dipfit_bem.py::test_bem_leadfield_and_multifit_match_fieldtrip \
tests/test_study_clustering.py::test_matlab_kmeans_numbering_matches_fixed_initial_centroids \
tests/test_phase2_file_channel_location.py::test_struct_near_assertion_matches_source \
--eeglab-backend=matlab --eeglab-root=<EEGLAB d0963be9> --eeglab-suite-root=<eeglab_tests fec88f9f>
- To bisect, run the same set at d0dea04, 5b78bb9 (Shape MATLAB outputs at the transport boundary #657), be93c06 (Clear Python-backend xfails at the root and the MATLAB transport #658), 73f148e (Clear the last Python-backend xfails #659) and 6b8012c ([DIPFIT] Match FieldTrip fminunc dipole fits on BESA and MNI #666).
Definition of done
- Each of the 5 tests passes in an
eeglab-reference.ymlrun on develop, with the run linked here. - Each failure is traced to its root cause and fixed there, in the eegprep code, the MATLAB reference helper, or the transport.
- No tolerance, ceiling,
tests/fuzz/tolerances.toml, or parity expected JSON changes, and no new skips or xfails. - If MATLAB itself is the outlier (for example, if fminunc stops early on the synthetic warp), document the EEGLAB quirk and make the test compare against the converged MATLAB result. Don't loosen the bound.
Activity
claude commentedon Nov 24, 2026
🤖 Plan:
Status: running the Python-backend reference suite on the fix branch.