forked from cortex-lab/Suite2P
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_stat.m
30 lines (22 loc) · 802 Bytes
/
get_stat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function stat = get_stat(res)
Ly = res.Ly;
Lx = res.Lx;
xs = repmat(1:Lx, Ly, 1);
ys = repmat((1:Ly)', 1, Lx);
xlx = repmat(-ceil(Lx/2):1:ceil(Lx/2), 2*ceil(Lx/2)+1, 1);
rgrid = sqrt(xlx.^2 + xlx'.^2);
rgridsort = sort(rgrid(:), 'ascend');
Nk = numel(unique(res.iclust));
for k = 1:Nk
ipix = find(res.iclust==k);
x0 = xs(ipix); y0 = ys(ipix);
rs = ((x0 - median(x0)).^2 + (y0 - median(y0)).^2).^.5;
stat(k).mrs = median(rs);
stat(k).npix = numel(ipix);
stat(k).mrs0 = median(rgridsort(1:stat(k).npix));
stat(k).med = [median(y0) median(x0)];
stat(k).ipix = ipix;
stat(k).lambda = res.M(ipix);
% stat(k).iscell = stat(k).mrs/stat(k).mrs0<1.3 & ...
% stat(k).npix>50 & stat(k).npix<300;
end