-
Notifications
You must be signed in to change notification settings - Fork 221
Add splitting functionality to curation and SortingAnalyzer
#3817
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
base: main
Are you sure you want to change the base?
Conversation
old_template = arr[self.sorting_analyzer.sorting.ids_to_indices([split_unit_id])[0], ...] | ||
new_indices = np.array([new_unit_ids.index(unit_id) for unit_id in new_splits]) | ||
new_array[new_indices, ...] = np.tile(old_template, (len(new_splits), 1, 1)) |
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.
@samuelgarcia this needs to be discussed. What should we do if the waveforms
extension is not there? The current behavior is copying, but we mught want to force recompute here
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.
maybe add warning here!
This is amazing camarade. I would do first a PR to focus only on the format. And then merge this one. |
I did camarade! #3760 |
new_unit_ids : list | None, default: None | ||
Optional new unit_ids for merged units. If given, it needs to have the same length as `merge_unit_groups`. | ||
If None, new ids will be generated. | ||
new_id_strategy : "append" | "take_first" | "join", default: "append" |
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.
new_id_strategy : "append" | "take_first" | "join", default: "append" | |
new_id_strategy : "append" | "split", default: "append" |
self, | ||
split_units: dict[list[str | int], list[int] | list[list[int]]], | ||
new_unit_ids: list[list[int | str]] | None = None, | ||
new_id_strategy: str = "append", |
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.
Add splitting_mode
to deal with templates recomputation
full_spike_indices = [] | ||
for label in np.unique(self.labels): | ||
label_indices = np.where(self.labels == label)[0] | ||
full_spike_indices.append(label_indices) |
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.
maybe make a helper function that returns a dict of indices given an array
# we propagate random spikes to avoid random spikes to be recomputed | ||
extension_dict_ = extension_dict_split.copy() | ||
extension_dict_.pop("random_spikes") | ||
analyzer_hard.extensions["random_spikes"] = analyzer_split.extensions["random_spikes"] |
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.
do a copy and ref to the analyzer here
Depends on #3760
Implements splitting functionality in:
sorting_tools
:apply_splits_to_sorting
SortingAnalyzer
:.split_units()
AnalyzerExtension
:_split_extension_data
(implemented function for all extensions and extended tests)