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

subtract out subsets of time-varying templates from raw data #180

Closed
tonylien opened this issue Jan 17, 2020 · 1 comment · Fixed by #595
Closed

subtract out subsets of time-varying templates from raw data #180

tonylien opened this issue Jan 17, 2020 · 1 comment · Fixed by #595

Comments

@tonylien
Copy link

I would like to do an analysis that extracts spike waveforms from the raw data (ie, the continuous voltage traces). However, instead of just extracting snippets of the raw data at the spike times of my unit of interest (which would be contaminated by any co-occuring spikes from other templates), I would like to subtract out the spikes from all other templates except for my unit of interest. If I understand correctly, this would be the best "estimate" of every individual spike waveform belonging of the unit of interest because any interference from temporally overlapping spikes from other templates would be subtracted off.

With static templates like in Kilosort1, it is straightforward to subtract out amplitude-scaled templates from the raw data. In Kilosort2, the templates vary over time, and the "predictData.m" script from the GUI shows how to reconstruct the raw data from the templates using rez2.mat.

This is ALMOST enough...BUT, the "predictData.m" script uses template and spike information from before the automatic merge/split step because it appears that the time-varying template data (rez.W_a, etc) are organized according to the "pre-merge/split" list of templates whereas I need to use the "post-merge/split" list of templates in order to not subtract out my unit of interest. How can I map between the "pre-merge/split" list of templates and the "post-merge/split" list of templates? I can't seem to find this information in the output.

Related questions about template information for clarification:

  1. In rez2.mat, fields like rez.W_a and rez.W contain different numbers of templates. I assume this is because (as mentioned above) rez.W_a refers to "pre-automerge/split" list of templates and rez.W refers to "post-automerge/split" list of templates. Is this true?

  2. The 2nd dimension of rez.W is larger than the number of different templates in st3 (ie, length(unique(rez.st3(:,2)), and further if you order the clusterView by ID in phy, you see that the ids are not continous and some IDs are skipped (ie tell user about undetected spikes #3 is missing: 0 1 4 5 6 7...). I assume this is just because templates undergoing merge or split in the automatic merge/split step are assigned a new index at the end of rez.W, but the old index is still there in rez.W?

Any help is greatly appreciated.

@marius10p
Copy link
Contributor

It would not be possible to do this after the template split and merge step, since that doesn't consider the time-varying templates. If your goal is to see the spikes without background, that it shouldn't really matter if you subtract the templates before or after the splits/merges.

  1. True.
  2. True.

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 a pull request may close this issue.

2 participants