Repository navigation
Check unit order in UnitsSelectionSorting against the parent's ids - #4814
Open
h-mayorquin wants to merge 1 commit into
Open
h-mayorquin wants to merge 1 commit into
h-mayorquin wants to merge 1 commit into
Conversation
Member
|
LGTM! @grahamfindlay do you want to take a look? |
Member
|
@h-mayorquin actually this other PR #4783 removes that logic alltoghether |
Member
|
bravo |
Contributor
Author
|
Yes, I am OK with having the other PR instead of this if they achieve the same. |
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.
This is in the context of optimizations related to #4811. This s a single line change.
When looking at the memory used by
rename_unitsI realized that the check added in #4581 to skip thenp.lexsortwhen the order of the units is preserved never passes for a rename. It searches the renamed ids (self.unit_ids) in the parent ids, and as they are not therenp.searchsortedreturns the same position for every unit (array([2, 2])for a rename of two units):spikeinterface/src/spikeinterface/core/unitsselectionsorting.py
Lines 63 to 65 in 93c612f
Plus,
np.searchsortedassumes that the parent ids are sorted. A selection that keeps the order of a parent with unsorted ids, string ids for example, also pays for the sort. This PR gets the positions withids_to_indices(self._unit_ids)instead, and both cases now skip the sort.