Repository navigation
Speed up common median reference on channel-sized axes - #4836
Open
JESUSROYETH wants to merge 1 commit into
Open
JESUSROYETH wants to merge 1 commit into
JESUSROYETH wants to merge 1 commit into
Conversation
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
Common median reference currently calls
np.medianfor each trace chunk. For the short channel axis used here, NumPy's full sort path turns out faster than its partition-based median path.This adds a private reduction helper: one or two numeric channels use their equivalent mean, finite numeric arrays with at least four channels sort and average the middle value(s), and three-channel, NaN, empty, or non-numeric inputs keep
np.median. No public API changes.Benchmark
I ran a complete cold-process
run_sorter("tridesclous2"), 20-minute/32-channel recording,n_jobs=1, on an Intel Sapphire Rapids box, five alternating pairs:Each of the five paired runs improved, 10.02–18.97%. On SpikeInterface's public 384-channel NHP snippet, the CMR reduction itself comes out 3.89× faster, with identical output hashes.
I ran the common-reference tests too:
16 passed, 1 skipped, Black/style clean. This is complementary to #4564 — it cuts default single-thread work without adding threading.