Fix main_channel_id donor selection when merged units disagree - #4773
Open
JESUSROYETH wants to merge 2 commits into
Open
Fix main_channel_id donor selection when merged units disagree#4773JESUSROYETH wants to merge 2 commits into
JESUSROYETH wants to merge 2 commits 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.
merge_units()gives the merged unitmain_channel_idfrom whichever unit is listed first in the merge group on any disagreement, not from the one with the most spikes like the comment says:np.argmax(num_spikes_per_unit.values())runs on adict_valuesview NumPy can't iterate (no__getitem__), so it always returns0.Minimal proof: 3 units with spike counts 8/5/7, merging
["b", "a"]returnschB(fewer spikes) instead ofchAonmain.main_channel_idis set by default for everySortingAnalyzersince #4624.Fix: look the count up by unit id instead of trusting
argmax/position. Doesn't touch the neighbouring note about recomputing from templates for analyzers — only makes the existing spike-count fallback do what its own comment says.Two regression tests (
test_sorting_tools.py,test_sortinganalyzer.py, covering bothapply_merges_to_sortingandSortingAnalyzer.merge_units()) fail onmain, pass patched; 48 tests total, black clean.