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

whitening_mat.npy problem #504

Closed
blinklab opened this issue Jun 7, 2022 · 4 comments · Fixed by #595
Closed

whitening_mat.npy problem #504

blinklab opened this issue Jun 7, 2022 · 4 comments · Fixed by #595

Comments

@blinklab
Copy link

blinklab commented Jun 7, 2022

In kilosort 2.0, the whitening_mat.npy file contains the real whitening matrix:
whiteningMatrix = rez.Wrot/rez.ops.scaleproc;
The inverse of this matrix is used to compute the template amplitude using this code
whiteningMatrixInv = whiteningMatrix^-1;

% here we compute the amplitude of every template...

% unwhiten all the templates
tempsUnW = zeros(size(templates));
for t = 1:size(templates,1)
    tempsUnW(t,:,:) = squeeze(templates(t,:,:))*whiteningMatrixInv;
end

% The amplitude on each channel is the positive peak minus the negative
tempChanAmps = squeeze(max(tempsUnW,[],2))-squeeze(min(tempsUnW,[],2));

By contrast, in kilosort 2.5 and kilosort 3.0, the whitening_mat.npy only contains a diagonal matrix that not correspond with the real whitening matrix used in the code:
whiteningMatrix = eye(size(rez.Wrot)) / rez.ops.scaleproc;

Which one is the reason to introduce this change in the code?.

@marius10p
Copy link
Contributor

I don't think this is right, could you please send the line numbers?

@SEONGGAP
Copy link

SEONGGAP commented Jul 6, 2022

@marius10p

I have a same issue.

After kilosort 2.5 and 3.0 (not 2.0), the whitening_mat.npy contains diagonal matrix.
For that reason, I cannot get template amplitude.

whitening matrix

Are there any changes in calculating a template amplitude at kilosort 2.5 and 3.0?

@zhengyangwang
Copy link

zhengyangwang commented Mar 28, 2023

I don't think this is right, could you please send the line numbers?

I think it was last updated here in rezToPhy and inherited by rezToPhy2, so "whitening_mat.npy" and "whitening_mat_inv.npy" do not contain the real matrices. Is there much significance to this change @marius10p ?

% whiteningMatrix = rez.Wrot/rez.ops.scaleproc;
whiteningMatrix = eye(size(rez.Wrot)) / rez.ops.scaleproc;
whiteningMatrixInv = whiteningMatrix^-1;

@JoeZiminski
Copy link

might this discussion be related to this issue?

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.

5 participants