Repository navigation
Validate and sort each channel once in compare_channels - #282
Open
raphaelvallat wants to merge 2 commits into
Open
raphaelvallat wants to merge 2 commits into
raphaelvallat wants to merge 2 commits into
Conversation
Split yasa.compare_detection into _check_parameters, _prepare_events and _compare_prepared. compare_channels now prepares each channel once and calls _compare_prepared for every pair, instead of re-validating and re-sorting (np.unique) the same events n_chan times. The public function is unchanged. 64 channels x 5,000 events: distance 6.3 s -> 2.4 s, intersection 4.8 s -> 4.7 s, identical scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/interval-iou-comparison #282 +/- ##
=============================================================
Coverage 98.60% 98.60%
=============================================================
Files 13 13
Lines 3159 3165 +6
Branches 429 431 +2
=============================================================
+ Hits 3115 3121 +6
Misses 23 23
Partials 21 21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- compare_channels only applies np.unique (distance) on top of _events_by_channel, instead of re-validating each channel. - _check_parameters no longer calls _check_method, so each entry point checks the method once. - Document the sorted-input precondition of _compare_prepared. - Test that parameters are validated even with a single channel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
AI review summary ( No correctness issues found. Matching results are identical to Fixed in e48072f:
Not changed:
🤖 Generated with Claude Code |
raphaelvallat
changed the base branch from
master
to
feat/interval-iou-comparison
October 17, 2026 13:40
raphaelvallat
marked this pull request as ready for review
October 17, 2026 13:41
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compare_channelscompares every pair of channels by calling the publicyasa.compare_detection, which checks, sorts and removes duplicate events on every call. The events of each channel are therefore re-checked and re-sorted 2 × (n_chan - 1) times. This PR splitscompare_detectioninto three private steps (_check_parameters,_prepare_eventsand_compare_prepared) so thatcompare_channelsprepares each channel once, then only runs the matching for each pair. The public function and its outputs are unchanged.On 64 channels with 5,000 events each,
compare_channelsgoes from 6.3 s to 2.4 s withmethod="distance"(4.8 s to 4.7 s withmethod="intersection"), with identical scores.One small behaviour change:
compare_channelsnow validatesiou_thresholdandmax_distance_secbefore comparing any pair of channels. Before, invalid values were silently ignored on a single-channel detection, because no comparison was run.Stacked on #278, through a copy of its branch in this repo (
feat/interval-iou-comparison). Once #278 is merged, this PR will be retargeted tomaster.AI assistance
Model used: Claude Opus 5.5 via Claude Code
Checklist
master, and I checked open PRs for conflictsIf AI-assisted:
/simplifywas run (preferred, Claude Code)🤖 Generated with Claude Code