Skip to content

Commit 47a5224

Browse files
committed
Replace all instances of gather() with gather_try()
1 parent ff5dd71 commit 47a5224

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

Diff for: driftCorrection/clusterAndDriftCorrection.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484

8585
% determine cluster assignment for this iteration
8686
[max_cf, id] = max(cf(:,:,2), [], 2);
87-
id = gather(id);
87+
id = gather_try(id);
8888
L = gpuArray.zeros(Nfilt, nSpikes, 'single');
8989
L(id' + [0:Nfilt:(Nfilt*nSpikes-1)]) = 1;
9090
dWU = dWU + L * clips;
@@ -115,7 +115,7 @@
115115
Urec= permute(Urec, [2 1 3]);
116116
Wrec = reshape(wPCA * Urec(:,:), nt0, Nchan, Nfilt);
117117

118-
Wrec = gather(Wrec);
118+
Wrec = gather_try(Wrec);
119119
Nrank = 3;
120120
W = zeros(nt0, Nfilt, Nrank, 'single');
121121
U = zeros(Nchan, Nfilt, Nrank, 'single');
@@ -130,7 +130,7 @@
130130

131131
Uinit = U;
132132
Winit = W;
133-
mu = gather(single(mu));
133+
mu = gather_try(single(mu));
134134
muinit = mu;
135135

136136
WUinit = zeros(nt0, Nchan, Nfilt);

Diff for: driftCorrection/collectRawClips.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
if ops.whiteningRange<Inf
152152
ops.whiteningRange = min(ops.whiteningRange, Nchan);
153-
Wrot = whiteningLocal(gather(CC), yc, xc, ops.whiteningRange);
153+
Wrot = whiteningLocal(gather_try(CC), yc, xc, ops.whiteningRange);
154154
else
155155
%
156156
[E, D] = svd(CC);

Diff for: fullMPMU.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
for j = 1:Nrank
3030
utu0 = U0(:,:,i)' * U0(:,:,j);
3131
if ops.GPU
32-
wtw0 = gather(mexWtW2(Params, W(:,:,i), W(:,:,j), utu0));
32+
wtw0 = gather_try(mexWtW2(Params, W(:,:,i), W(:,:,j), utu0));
3333
else
3434
wtw0 = getWtW2(Params, W(:,:,i), W(:,:,j), utu0);
3535
wtw0 = permute(wtw0, [2 3 1]);
@@ -56,7 +56,7 @@
5656
end
5757
% mWtW = mWtW - diag(diag(mWtW));
5858

59-
% rez.WtW = gather(WtW);
59+
% rez.WtW = gather_try(WtW);
6060
%
6161
clear wtw0 utu0 U0
6262
%
@@ -165,7 +165,7 @@
165165
coefs = reshape(permute(coefs, [3 1 2]), [], numel(st));
166166
coefs = coefs .* maskPC(:, id+1);
167167
iCoefs = reshape(find(maskPC(:, id+1)>0), 3*nNeighPC, []);
168-
rez.cProjPC(irun + (1:numel(st)), :) = gather(coefs(iCoefs)');
168+
rez.cProjPC(irun + (1:numel(st)), :) = gather_try(coefs(iCoefs)');
169169
end
170170
if ~isempty(ops.nNeigh)
171171
% template coefficients

Diff for: initialize/optimizePeaks.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
[max_cf, id] = max(cf, [], 2);
7575

76-
id = gather(id);
76+
id = gather_try(id);
7777
% x = ci([1:nSpikesPerBatch] + nSpikesPerBatch * (id-1)')' - mu(id) .* lam(id);
7878
idT(:,ibatch) = id;
7979

@@ -105,7 +105,7 @@
105105
Urec= permute(Urec, [2 1 3]);
106106
Wrec = reshape(wPCA * Urec(:,:), nt0, Nchan, Nfilt);
107107

108-
Wrec = gather(Wrec);
108+
Wrec = gather_try(Wrec);
109109
Nrank = 3;
110110
W = zeros(nt0, Nfilt, Nrank, 'single');
111111
U = zeros(Nchan, Nfilt, Nrank, 'single');
@@ -122,7 +122,7 @@
122122

123123
Uinit = U;
124124
Winit = W;
125-
mu = gather(single(mu));
125+
mu = gather_try(single(mu));
126126
muinit = mu;
127127

128128
WUinit = zeros(nt0, Nchan, Nfilt);

Diff for: mainLoop/update_params.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
[Nchan, Nfilt, Nrank] = size(U);
44

5-
dWUtotCPU = gather(dWUtot);
5+
dWUtotCPU = gather_try(dWUtot);
66
ntot = sum(nspikes,2);
77

88
for k = 1:Nfilt
99
if ntot(k)>5
10-
[Uall, Sv, Vall] = svd(gather(dWUtotCPU(:,:,k)), 0);
1110

11+
[Uall, Sv, Vall] = svd(gather_try(dWUtotCPU(:,:,k)), 0);
1212
Sv = diag(Sv);
1313
sumSv2 = sum(Sv(1:Nrank).^2).^.5;
1414
for irank = 1:Nrank

Diff for: preprocessData.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175

176176
if ops.whiteningRange<Inf
177177
ops.whiteningRange = min(ops.whiteningRange, Nchan);
178-
Wrot = whiteningLocal(gather(CC), yc, xc, ops.whiteningRange);
178+
Wrot = whiteningLocal(gather_try(CC), yc, xc, ops.whiteningRange);
179179
else
180180
%
181181
[E, D] = svd(CC);

Diff for: tests/gather_mean_spikes.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
inds = repmat(st', nt0, 1) + repmat(ts, 1, numel(st));
6464

6565
Wraw(:,:,iNN) = Wraw(:,:,iNN) + ...
66-
gather(squeeze(sum(reshape(dataRAW(inds, :), nt0, numel(st), Nchans),2)));
66+
gather_try(squeeze(sum(reshape(dataRAW(inds, :), nt0, numel(st), Nchans),2)));
6767
end
6868
end
6969

0 commit comments

Comments
 (0)