-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPartitionTable.m
More file actions
72 lines (58 loc) · 2.66 KB
/
PartitionTable.m
File metadata and controls
72 lines (58 loc) · 2.66 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% divide arenas into N partitions
% compute fraction of arena explored / session
% compute number of revisits of each partition
% repeat over different sized partitions
maxX = 1280;
maxY = 1020;
nM = max(mouse);
nS = max(sess);
parts = (3:100).^2;
nP = length(parts);
% minreturntime = [3,6,9,12,15,18,21,24,27,30];
% nT = length(minreturntime);
pExplored = nan(nP,nM,nS);
% pReturned = nan(nM,nS,nP,nT);
% tReturned = nan(nM,nS,nP,nT);
fExplored = nan(nM,nS);
% fReturned = nan(nM,nS,nP,nT);
for iM=1:nM
for iS=1:nS
k = mouse==iM & sess==iS & ~edge & ~edgespot & ~removeint2s & V<100 & nV<100;
kall = sum(k);
if kall > 0
fExplored(iM,iS) = sum(k)./sum(kall);
parfor iN=1:nP % number of partitions
nbinsx = linspace(44.8,maxX-44.8,ceil(sqrt(parts(iN))));
nbinsy = linspace(44.8,maxY-44.8,ceil(sqrt(parts(iN))));
[H,~,~,Xct,Yct]=histcounts2(x(k),y(k),nbinsx,nbinsy);
H0 = H(:);
pExplored(iN,iM,iS) = sum(H0>0)./length(H0);
% find returns to partition
% [i,j]=ind2sub(size(H),1:length(H0));
% for iT=1:nT
% sumreturn = 0;
% sreturns = 0;
% treturn = [];
% for iP=1:length(H0)
% if H0(iP)>1 % potential return
% kxy = find(Xct==i(iP) & Yct==j(iP));
% dkxy = cat(1,0,diff(kxy));
% anygood = dkxy>=minreturntime(iT)*50;
% if any(anygood)
% sreturns = sum(anygood) + sreturns;
% sumreturn = sumreturn + 1;
% treturn = cat(1,treturn, dkxy(anygood)/50);
% end
% end
% end
%
% pReturned(iM,iS,iN,iT) = sumreturn./length(H0); % percent of partitions returned to
% tReturned(iM,iS,iN,iT) = nanmedian(treturn); % median time of returns
% fReturned(iM,iS,iN,iT) = sreturns./sum(H0); % percent of time spent re-exploring
% end
end
end
disp(iS);
end
disp(iM);
end