Skip to content

[Tests] Add half-count tie test for 2-D trimmed channel scores - #636

Merged
suraj-ranganath merged 1 commit into
developfrom
cursor/trimmed-score-half-count-test-b7ae
Nov 18, 2026
Merged

suraj-ranganath merged 1 commit into
developfrom
cursor/trimmed-score-half-count-test-b7ae

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Add a parametrized test for the 2-D trimmed channel score path at n=5, 15, and 25, where n*0.1 is a half count. Expected kept ranges are 1:4, 2:13, and 3:22, and the n=5 and n=25 cases fail if MATLAB half-away-from-zero rounding is replaced by Python round.

Fixes #570
Supersedes #571

Open in Web Open in Cursor 

Cover the 2-D trim at n=5, 15, and 25, where ten percent of the count
is a half integer and MATLAB rounding keeps a different range than
Python round.

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.

@suraj-ranganath
suraj-ranganath marked this pull request as draft November 18, 2026 09:44
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 18, 2026 09:44
@claude

claude Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Looks good. The new test checks the 2-D (single-sweep) trim path in _trimmed_channel_scores at half counts. Its expected index ranges match EEGLAB's formula.
  • Highest-risk area: None identified. This is a test-only change of 10 lines.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

I checked the expected ranges against upstream rejkurt.m:110-111 (fetched from sccn/eeglab; the vendored submodule isn't checked out in CI):

minind  = max(round(length(tmpkurt)*0.1),1);
maxind  = round(length(tmpkurt)-round(length(tmpkurt)*0.1));
n MATLAB minind:maxind Test expectation With Python round
5 1:4 1:4 ✅ 1:5 (fails)
15 2:13 2:13 ✅ 2:13 (same)
25 3:22 3:22 ✅ 2:23 (fails)
  • The jointprob.m:115 form, round(n*0.1):end-round(n*0.1), gives the same ranges for these n.
  • The PR description is accurate: the n=5 and n=25 cases catch a regression to Python's banker's rounding, and n=15 doesn't. n=15 is still the example the issue asks for.
  • The expected values don't reuse the implementation. They come from a hand-picked slice of values.
  • The scores are passed in reverse order (values[::-1]), so the test also covers the sort.
  • Using squared values means dropping a different element changes both the mean and the std, so a wrong range is detected.

I did not run the test: uv run pytest was not permitted in this job. I worked through the expected values above by hand. Fixes #570.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

@suraj-ranganath
suraj-ranganath merged commit 20137e1 into develop Nov 18, 2026
14 of 15 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.

Add a half-count tie test for 2-D _trimmed_channel_scores

2 participants