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

Split function and new_unit_ids definition #2694

Closed
OlivierPeron opened this issue Apr 10, 2024 · 2 comments · Fixed by #2775
Closed

Split function and new_unit_ids definition #2694

OlivierPeron opened this issue Apr 10, 2024 · 2 comments · Fixed by #2775
Labels
curation Related to curation module

Comments

@OlivierPeron
Copy link
Contributor

Hi !

I was looking into the curation module and didn't quite get how to use the split function. Let's say I want to split my unit into 3. To do so I just have to properly define my indices_list and then I could just do as so:
cs.split(unit_id, indices_list)

The class SplitUnitSorting is able to handle this, thanks to tot_splits = max([v.max() for v in indices_list]) + 1.
But then we are asserting assert len(new_unit_ids) <= tot_splits, and new_unit_ids is defined in the CurationSorting class :

new_unit_ids = self._get_unused_id(2)
        new_sorting = SplitUnitSorting(
            current_sorting,
            split_unit_id=split_unit_id,
            indices_list=indices_list,
            new_unit_ids=new_unit_ids,
            properties_policy=self._properties_policy,
        )

Therefore even if do properly my list, there will always be only 2 new_unit_ids.

Would solve it doing new_unit_ids = self._get_unused_id(max(np.unique(indices_list))) but I am not sure weither this should be changed or if I am not doing it the proper way.

Thanks !

@OlivierPeron OlivierPeron changed the title Split function use Split function and new_unit_ids definition Apr 10, 2024
@alejoe91 alejoe91 added the curation Related to curation module label Apr 10, 2024
@alejoe91
Copy link
Member

Oups! You're right! I think we just need to change that line to:

new_unit_ids = self._get_unused_id(len(indices_list))

do you agree @OlivierPeron ? Do you want to try to make a PR with this change and test it out?

@OlivierPeron
Copy link
Contributor Author

Ok !
I don't think using the len of indices_list is the way to go as its len is the number of segments in the recording, and for each segment we have an array as big as the unit's spike train.

In the SplitUnitSorting class, the proper calculation is done I think:
tot_splits = max([v.max() for v in indices_list]) + 1

Then we would just have to do :
new_unit_ids = self._get_unused_id(tot_splits)

and this way we could get rid of the assertion line 52 of the SplitUnitSorting class:
assert len(new_unit_ids) <= tot_splits, "indices_list has more id indices than the length of new_unit_ids"
as this way we would have len(new_unit_ids) == tot_splits.

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
2 participants