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

TemplateFeature sparse->full transform messed up if there are < 32 clusters #31

Open
lshaheen opened this issue Apr 8, 2021 · 0 comments

Comments

@lshaheen
Copy link

lshaheen commented Apr 8, 2021

If there are less than 32 clusters, the template_feature_ind.npy matrix that's used to translate template_feature.npy data from sparse into full has repeated rows. This makes it so that the assignment here is messed up. It seems to only happen if splitAllClusters.m in Kilosort 2 or 2.5 is run. I didn't get to the bottom of why that is. Something to do with the template projections not getting recomputed I guess.

But in any case I think it's easily fixed by adding some logic on line 119 of model.py:

    if n_channels_loc > n_channels:
        # If there are fewer templates (n_channels here) than the number of 
        # mapping indicies (32 for template projections by KiloSort), 
        # limit the indexing to avoid an incorrect mapping
        out[x[:, :n_channels, ...], cols_loc[:, :n_channels, ...], ...] = data[:, :n_channels, ...]
    else:
        out[x, cols_loc, ...] = data

Not really sure what else this thing does so I didn't want to put in a pull request.

Here's what it looks like before the fix. You can see cluster 9 is overlapped with the noise cluster.
2021-04-08_14h04_48

Here's after the fix:
2021-04-08_14h29_48

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

No branches or pull requests

1 participant