Skip to content

Follow-up to #135: another indexing issue with KS4 + Phy curated data #156

Description

@yuanning-research

Hi,

I was testing UnitMatch on a Kilosort4 dataset that had been manually curated in Phy and ran into what seems like a related issue to #135.

Following the workaround discussed in #135, I skipped RemovingEmptyClusters, which allowed preprocessing to continue. However, the pipeline later stopped in ExtractKilosortData.m at:
depthtmp(clusid) = round(sp.templateDepths(clusid));
with:

Index exceeds the number of array elements.
Index must not exceed 327.

At the breakpoint:

clusid = 328
length(sp.templateDepths) = 327
length(clusidtmp) = 332
max(clusidtmp) = 351

I checked several sessions from the same dataset and found that, after manual curation, cluster IDs could extend well beyond the available template indices. Looking through the data, it appears that some curated clusters correspond to multiple templates. For example:

cluster 476 -> templates 19, 26
cluster 477 -> templates 155, 156
cluster 478 -> templates 409, 418

This makes me wonder whether there may be other places in the MATLAB pipeline, beyond RemovingEmptyClusters, that still assume cluster indices and template indices remain aligned after merge/split operations in Phy.

I’m not sure whether this is expected behavior or whether there is already a recommended workaround, but I thought it might be useful to report since it appears to arise from the same underlying issue discussed in #135.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions