Skip to content

Conversation

@chrishalcrow
Copy link
Member

@chrishalcrow chrishalcrow commented Nov 5, 2025

Compute potential automerges using presets inherited from spikeinterface (and still do similarity, since it's so nice and simple!)

Possible improvement: use the spikeinterface nomonclenture of presets instead of methods?

Screenshot 2025-11-05 at 18 57 05

@alejoe91
Copy link
Member

alejoe91 commented Nov 5, 2025

Compute potential automerges using presets inherited from spikeinterface (and still do similarity, since it's so nice and simple!)

Possible improvement: use the spikeinterface nomonclenture of presets instead of methods?

Screenshot 2025-11-05 at 18 57 05

Awesome! I agree for the naming. In addition, we could actually reframe the similarity as a custom preset, which only runs the similarity step :) so all methods would use the spikeinterface machinery. What do you think?

@samuelgarcia
Copy link
Member

bravo

@chrishalcrow
Copy link
Member Author

I changed all the naming to match the "preset" language we use in spikeinterface.

I like the idea of eventually making the similarity be a spikeinterface preset, but I really like the current similarity tools: you can try different similarity metrics, it's all cached nicely, it won't overwrite the template_similarity you've already computed. I use it all the time! This is quite a lot different than the template_similarity in automerge and we probably need a little think. Can we keep it for now??

@chrishalcrow
Copy link
Member Author

@alejoe91 @samuelgarcia in mergeview, line 100 (

values.append(self.merge_info[info_name][unit_ind1][unit_ind2])
) we store some merge info:

for info_name in more_labels:
    values = []
    for unit_id1, unit_id2 in itertools.combinations(group_ids, 2):
        unit_ind1 = unit_ids.index(unit_id1)
        unit_ind2 = unit_ids.index(unit_id2)
        values.append(self.merge_info[info_name][unit_ind1][unit_ind2])

Questions:

  1. Why?
  2. We assume merge_info is a unitsxunits array, but for spikeinterface presets it can be a vector. E.g. the num_spikes step gives a bool mask per unit: whether the unit continues in the merging algorithm or not. So this causes an error.

@alejoe91
Copy link
Member

alejoe91 commented Nov 6, 2025

@alejoe91 @samuelgarcia in mergeview, line 100 (

values.append(self.merge_info[info_name][unit_ind1][unit_ind2])

) we store some merge info:

for info_name in more_labels:
    values = []
    for unit_id1, unit_id2 in itertools.combinations(group_ids, 2):
        unit_ind1 = unit_ids.index(unit_id1)
        unit_ind2 = unit_ids.index(unit_id2)
        values.append(self.merge_info[info_name][unit_ind1][unit_ind2])

Questions:

  1. Why?
  2. We assume merge_info is a unitsxunits array, but for spikeinterface presets it can be a vector. E.g. the num_spikes step gives a bool mask per unit: whether the unit continues in the merging algorithm or not. So this causes an error.

Ah now I understand why @samuelgarcia had a list of supported labels...I thought we could generalize!

@alejoe91
Copy link
Member

alejoe91 commented Nov 7, 2025

@chrishalcrow can you test now? Should be fixed!

@chrishalcrow
Copy link
Member Author

It works - and finds some beautiful splits!

Screenshot 2025-11-07 at 15 36 22

Comment on lines +108 to +127
merge_info = self.merge_info[info_name]
if isinstance(merge_info, np.ndarray) and \
merge_info.shape == (len(unit_ids), len(unit_ids)):
for unit_id1, unit_id2 in itertools.combinations(group_ids, 2):
unit_ind1 = unit_ids.index(unit_id1)
unit_ind2 = unit_ids.index(unit_id2)
values.append(merge_info[unit_ind1][unit_ind2])

if max_group_size == 2:
row[info_name] = f"{values[0]:.2f}"
else:
min_, max_ = min(values), max(values)
row[f"{info_name}_min"] = f"{min_:.2f}"
row[f"{info_name}_max"] = f"{max_:.2f}"
else:
min_, max_ = min(values), max(values)
row[f"{info_name}_min"] = f"{min_:.2f}"
row[f"{info_name}_max"] = f"{max_:.2f}"
if info_name in labels:
labels.remove(info_name)
elif f"{info_name}_min" in labels:
labels.remove(f"{info_name}_min")
labels.remove(f"{info_name}_max")
Copy link
Member

Choose a reason for hiding this comment

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

For @samuelgarcia

Changed the logic here to be able to show any extra outs with shape (num_units, num_units), instead of pre-selecting potential labels

num_channels = 32
num_units = 16
elif case == 'medium_split':
elif case == 'medium-split':
Copy link
Member

Choose a reason for hiding this comment

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

changed this to - to have this line work:

test_folder.stem.split('_')[-1]

@alejoe91 alejoe91 merged commit 95128fa into SpikeInterface:main Nov 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants