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

fixed bug in my_conv2 #3

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions kspy/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def my_conv2(S1, sig, axis):
S1 = S1[tmax:, :]
S1 /= cNorm

return S1


def set_cutoff(rez):
# after everything else is done, this function takes spike trains and cuts off
Expand Down Expand Up @@ -441,8 +443,8 @@ def splitAllClusters(rez, flag):
continue

# now decide if the split would result in waveforms that are too similar
c1 = cp.matmul(wPCA, cp.reshape(cp.mean(clp0[ilow, :], 0), 3, -1)) # the reconstructed mean waveforms for putative cluster 1
c2 = cp.matmul(wPCA, cp.reshape(cp.mean(clp0[~ilow, :], 0), 3, -1)) # the reconstructed mean waveforms for putative cluster 2
c1 = cp.matmul(wPCA, cp.mean(clp0[ilow, :], 0).reshape(3, -1)) # the reconstructed mean waveforms for putative cluster 1
c2 = cp.matmul(wPCA, cp.mean(clp0[~ilow, :], 0).reshape(3, -1)) # the reconstructed mean waveforms for putative cluster 2
cc = cp.corrcoef(c1, c2) # correlation of mean waveforms
n1 = sqrt(cp.sum(c1 ** 2)) # the amplitude estimate 1
n2 = sqrt(cp.sum(c2 ** 2)) # the amplitude estimate 2
Expand Down Expand Up @@ -518,3 +520,5 @@ def splitAllClusters(rez, flag):
rez.Wphy = cp.concatenate((cp.zeros((1 + ops.ntomin, Nfilt + 1, Nrank)), rez.W), axis=0)

rez.isplit = isplit # keep track of origins for each cluster

return rez