-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Correct unit ID matching in sortingview curation #2037
Conversation
Refine the logic for matching unit IDs in the sortingview curation process. Instead of using a potentially ambiguous containment check, unit IDs are now split at the '-' character, ensuring accurate mapping between unit labels and merged unit IDs. Additionally, introduced a unit test to validate the improved behavior and guard against potential false positives in future changes.
for more information, see https://pre-commit.ci
Thanks @rkim48 I have one comment. In case of str units, after a merge, the merged unit (e.g. ,
However, this is not the case for int units. My suggestion would be to convert all unit ids to strings when applying sortingview curation. Note that we have been discussing about forcing unit and channel IDs to always be strings: #1432 |
…iting labels, etc.
for more information, see https://pre-commit.ci
Thanks for the feedback. Can you check my latest commit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is necessary to have print('success')
statements in general for testing since in the case of success they will pass silently and in the case of failure they won't ever be triggered.
Remove print('success') statements Co-authored-by: Zach McKenzie <[email protected]>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkim48 thanks for the changes. I think that we could simplify a lot the implementation.
See my comments (I hope they are clear!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes have been made
Issue:
In the process of applying sortingview curation for unit ids of dtype int, the function was using an "in" operator to match unit_id with unit_label, which resulted in false positives. For instance, a unit_id of 10 would mistakenly match a unit_label of 1.
Fix:
Enhanced the unit ID matching logic to handle both integer and string types properly, ensuring correct unit curation.
Added split logic for merged units to correctly identify individual unit parts.
Test introduced:
Introduced a unit test test_false_positive_curation() in test_sortingview_curation.py to capture the false-positive scenario, ensuring unit_id 10 doesn't get labeled when unit_label 1 is specified. It also ensures correct curation for both int and string type unit IDs.
Additional information:
I am using Mountainsort5.