-
Notifications
You must be signed in to change notification settings - Fork 226
Speedup template_similarity #4211
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
Conversation
for more information, see https://pre-commit.ci
I think we should not do this in the same PR. The internal sparse representaion of template will have impact at many places, like merging or plotting. Lets do this more carfully. |
|
You are right regaring the sparsity masks. This has been moved in #4212 |
|
@samuelgarcia this one is needed for runtimes of both SC2, TDC2, and very large in vitro recordings |
| for old_ind1, unit_ind1 in zip(old_units_inds, sub_units_inds): | ||
| s = self.data["similarity"][old_ind1, old_units_inds] | ||
| similarity[unit_ind1, sub_units_inds] = s | ||
| similarity[sub_units_inds, unit_ind1] = s |
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.
Cool. Smater
| connected_mask = np.logical_and(sparsity_mask[i, :], other_sparsity_mask) | ||
| not_connected_mask = np.sum(connected_mask, axis=1) == 0 | ||
| local_mask = np.logical_or( | ||
| sparsity_mask[i, :], other_sparsity_mask | ||
| ) # shape (other_num_templates, num_channels) | ||
| for local_i in np.flatnonzero(not_connected_mask): | ||
| local_mask[local_i] = False | ||
|
|
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.
Of course!
|
Merci pour le bug! |
|
I merge this, this is important. |
While restructuring the components, we introduced a slowdown in template_similarity, by mistake. I don't think this causes bug, but rather a global problem with speed since we are computing distances for all templates, instead of only those that are intersecting.