Skip to content
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 split in more than 2 units and extend curation docs and tests #2775

Merged
merged 7 commits into from
May 10, 2024

Conversation

alejoe91
Copy link
Member

Fixes #2694 and replaces #2695 (by @OlivierPeron)

@OlivierPeron when making aPR it's better to create a branch different than main so we can directly contribute to it ;)

@alejoe91 alejoe91 added the curation Related to curation module label Apr 29, 2024
Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the docstrings @alejoe91. One question.

src/spikeinterface/curation/curationsorting.py Outdated Show resolved Hide resolved
@alejoe91
Copy link
Member Author

alejoe91 commented May 9, 2024

@zm711 is this good to merge? I think that the docstring improvement might fix #2816

Copy link
Collaborator

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep looks good with just one more question @alejoe91, and then style-wise we could do
list[str | int] but I don't think that is absolutely necessary for the docstrings, but might make it a bit clearer that ids can still be ints or strings.

src/spikeinterface/curation/curationsorting.py Outdated Show resolved Hide resolved
@alejoe91
Copy link
Member Author

Fixes #2816

The split function has been improved to always zero-base the indices list.
Before, the indices array was expected to be between 0 and n_splits - 1, but I think this requirement is too strict.

Now a zero-based array is build out of unique values of the indices_list. This behavior is also tested

Comment on lines 51 to 53
for i, split_unit_idx in enumerate(split_unit_indices):
indices_zero_based[segment_index][indices_list[segment_index] == split_unit_idx] = i

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we potentially give i a better name. In the future I think it will be better to have the counter with the name of what it is rather than just being the counter. To be honest this double for is hard for me to parse because of the i.

@alejoe91 alejoe91 merged commit 551a3b4 into SpikeInterface:main May 10, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
curation Related to curation module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split function and new_unit_ids definition
2 participants