Skip to content

[docs] Correct parity-matrix test notes to match the tests - #613

Merged
suraj-ranganath merged 2 commits into
developfrom
cursor/fix-parity-matrix-evidence-433-6ce7
Nov 12, 2026
Merged

suraj-ranganath merged 2 commits into
developfrom
cursor/fix-parity-matrix-evidence-433-6ce7

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Rewrite parity-matrix test_notes so each citation names the test and what it asserts, and separate provenance-linked smoke calls, Python behavioral tests, and live MATLAB comparisons. The Sphinx matrix section now states that these notes are not unconditional MATLAB-parity proof.

Fixes #433

Open in Web Open in Cursor 

Name the asserting tests, and separate provenance-linked smoke calls from Python behavioral checks and live MATLAB comparisons.

Co-authored-by: Suraj Ranganath <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

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

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Reviewing PR #613

  • Pre-review gate
  • Read diff and cited tests
  • Validate findings
  • Post review

View job run

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 12, 2026 05:38
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 12, 2026 05:38
@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 1m 57s —— View job


Code review

  • Overall assessment: Needs one small fix. This is a docs-only change (two parity-matrix JSON files plus development.rst). I checked the rewritten notes against the tests they cite. Every cited test name I looked up exists, and almost every described assertion matches the test body. One note still claims an assertion that isn't there.
  • Highest-risk area: the pop_rejchanspec row in docs/parity/eeglab_core_parity_matrix.json.
  • Merge recommendation: Needs changes (one sentence; there is a committable suggestion inline).

Blocking

None.

Important

  • docs/parity/eeglab_core_parity_matrix.json:4538 (pop_rejchanspec): the note says test_reference_rejchanspec_original_workflow "asserts no rejected channels". The test makes six pop_rejchanspec(..., nargout=0) calls, discards every result and asserts nothing (tests/test_phase7_long_tail_helpers.py:366-396). That is the kind of overclaim [docs] Review parity-matrix test_notes rewritten after test pruning #433 is meant to remove. Fix: replace it with "asserts nothing about the result". The inline comment has the suggestion.

Nits

  • docs/parity/eeglab_core_parity_matrix.json:3791 (pop_chancenter): "asserts omit index 4 leaves Cz in place" suggests the test covers 1-based omit handling. It uses center=[0, 0, 0], which moves no channel, so the coordinate check passes whether or not the omit index works (tests/test_phase2_file_channel_location.py:566-574). Only the history string [4] actually checks 1-based indexing. Fix: reword the note to say that, or strengthen the test to use a non-zero center in a separate PR.

Test gaps

None. No behavior changes, so no new tests are needed.

EEGLAB parity notes

None. No runtime or EEGLAB-ported code changed, so the MATLAB reference run in AGENTS.md is not required.

What I checked against the cited tests:

  • pop_chancenter and chancoresp: the 0.11 center bound and the autoselect pairs match.
  • readlocs, pop_readlocs and pop_writelocs: the smoke-only reference calls, 342 channels, BESA radii, quoted CED type and round trip all match.
  • runscript: the menu tests do patch pop_runscript, and the reference test asserts nothing.
  • cbar, copyaxis, slider and headplot: these really are gui-marked smoke calls. The three headplot *_matches_eeglab tests are live MATLAB comparisons that skip when MATLAB is missing.
  • STUDY precompute, grouped-plot and topoplot rows: the timesout/nfreqs values, the sentinel and baseline assertions, the component pairs [[1, 1, 2, 2]], and the --run-heavy-reference gating in tests/conftest.py all match.
  • Final matrix: the dipfit transform values, the AFNI voxel→xyz value, and the gcompreject OK/cancel arrays plus ICLabel 0.94 for pop_prop_extended all match.

The new evidence-categories paragraph in development.rst is consistent with how the notes use those categories.

"gui"
],
"test_notes": "Covered by the rejchanspec original-workflow reference test and the pop_rejchanspec history test in tests/test_phase7_long_tail_helpers.py."
"test_notes": "tests/test_phase7_long_tail_helpers.py::test_reference_rejchanspec_original_workflow is a provenance-linked GUI smoke call of six option combinations and asserts no rejected channels. test_pop_rejchanspec_rejects_spectral_outlier_and_returns_history is a Python behavioral test: it asserts the outlier channel is removed (nbchan 2, labels Ch1 and Ch3) and that the history command starts with pop_rejchanspec."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: this note says the test "asserts no rejected channels", but test_reference_rejchanspec_original_workflow asserts nothing. Each of the six pop_rejchanspec calls uses nargout=0 and throws its result away, and the loop only closes the histogram figure:

):
eeglab_backend(
"pop_rejchanspec",
eeg,
"elec",
selected,
"freqlims",
np.array(frequencies),
threshold_kind,
np.array(threshold),
"averef",
average,
"plothist",
histogram,
nargout=0,
)
if histogram == "on":
if request.config.getoption("--eeglab-backend") == "matlab":
request.getfixturevalue("eeglab_matlab_engine").close(nargout=0)
else:
plt.close()

The PR exists to make these notes match their tests, so this sentence brings back the same kind of overclaim.

Suggested change
"test_notes": "tests/test_phase7_long_tail_helpers.py::test_reference_rejchanspec_original_workflow is a provenance-linked GUI smoke call of six option combinations and asserts no rejected channels. test_pop_rejchanspec_rejects_spectral_outlier_and_returns_history is a Python behavioral test: it asserts the outlier channel is removed (nbchan 2, labels Ch1 and Ch3) and that the history command starts with pop_rejchanspec."
"test_notes": "tests/test_phase7_long_tail_helpers.py::test_reference_rejchanspec_original_workflow is a provenance-linked GUI smoke call of six option combinations and asserts nothing about the result. test_pop_rejchanspec_rejects_spectral_outlier_and_returns_history is a Python behavioral test: it asserts the outlier channel is removed (nbchan 2, labels Ch1 and Ch3) and that the history command starts with pop_rejchanspec."

"file_channel"
],
"test_notes": "Covered by the pop_chancenter reference cases (empty center, with and without omitchans, recorded calls), 1-based omit indices, console history, and GUI cancel path in tests/test_phase2_file_channel_location.py; adjacent pop_chanedit coverage remains in tests/test_phase1b_file_edit_pop_functions.py."
"test_notes": "tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_empty_center asserts the fitted center is within 0.11 of the origin. test_reference_pop_chancenter_no_omitchans and test_reference_pop_chancenter_with_omitchans assert translated coordinates against convertlocs. Those three compare recorded expectations through eeglab_backend and become a live MATLAB comparison only with --eeglab-backend=matlab. test_reference_pop_chancenter_nine_recorded_location_calls is a provenance-linked smoke call of nine centers and omit lists and asserts nothing. Python behavioral tests: test_pop_chancenter_uses_one_based_omit_indices_and_console_return_shape asserts omit index 4 leaves Cz in place and the history command uses [4]; test_pop_chancenter_gui_cancel_path_returns_original_without_history asserts gui=True with no submitted result returns the same EEG and an empty command; test_console_pop_chancenter_updates_session_history_and_current_dataset asserts CURRENTSET [1] and the same history command."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "asserts omit index 4 leaves Cz in place" is literally true, but it reads as if the test checks 1-based omit handling. It doesn't. The test passes center=[0, 0, 0], which moves no channel at all, so Cz stays put whether index 4 is omitted, off by one, or ignored:

def test_pop_chancenter_uses_one_based_omit_indices_and_console_return_shape() -> None:
eeg = _eeg()
out, command = pop_chancenter(eeg, [0.0, 0.0, 0.0], [4], return_com=True)
assert out["chanlocs"][3]["X"] == 0.0
assert out["chanlocs"][3]["Z"] == 1.0
assert command == "EEG = pop_chancenter(EEG, [0 0 0], [4]);"
_assert_parseable(command)

The only part that checks 1-based indexing is the history string [4]. Suggested fix: reword the note to "asserts the history command records omit index [4]; the zero center leaves the coordinate assertion unable to distinguish omitted channels." A better fix is a separate follow-up that strengthens the test to use a non-zero center such as [1, -1, 0] and assert channels 1 to 3 shift while channel 4 does not.

The spectral-rejection reference call checks no result, and the channel-center omit test only records index [4] in history because its center is the origin.

Co-authored-by: Suraj Ranganath <[email protected]>
@suraj-ranganath
suraj-ranganath marked this pull request as draft November 12, 2026 05:42
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 12, 2026 05:42
@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 51s —— View job


Code review

  • Overall assessment: Looks good. This is a docs-only change: two parity-matrix JSON files and development.rst. The latest commit (6b5f789) fixes both findings from the earlier review. The pop_rejchanspec note now says the reference test "asserts nothing about the result". The pop_chancenter note now says only the [4] history string checks the omit index, because the zero center can't tell omitted channels apart.
  • Highest-risk area: None identified. The test_notes claims I spot-checked match the tests they cite.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. No behavior changed.

EEGLAB parity notes

None. No runtime or EEGLAB-ported code changed, so the MATLAB reference run in AGENTS.md is not required.

What I checked against the cited tests:

  • gui and slow markers: the notes say these tests are kept out of the normal non-GUI lane, and the markers are there.
    • test_reference_rejchanspec_original_workflow, test_reference_runscript_original_sample_script, test_reference_cbar_original_calls and test_reference_slider_original_calls are gui-marked.
    • test_reference_std_precomp and test_reference_std_erspplot_channel_cache are slow + gui.
  • cbar reference test: it reads properties with get(h) / handle.properties() and asserts nothing, which matches the note.
  • test_cluster_edit_rename_merge_moveoutlier_and_plot: it only asserts figure is not None for the plot step, so "leaves topography values unchecked" is accurate.
  • test_trial_factor_channel_cells_reconstruct_from_single_trial_caches: it uses timesout: 5, nfreqs: 4 and is parametrized over spec/ersp/itc.

I could not run tests/test_eeglab_parity_matrix.py and tests/test_eeglab_final_parity_matrix.py in this job because the command needed approval. CI runs them.

@suraj-ranganath
suraj-ranganath merged commit b2b1b77 into develop Nov 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] Review parity-matrix test_notes rewritten after test pruning

2 participants