-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExampleScript.m
66 lines (64 loc) · 1.92 KB
/
ExampleScript.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
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
data_dir = ["layer7data", "layer6data", "layer5data", "layer4data", "layer3data"];
layer_count = [7,6,5,4,3];
store_r2 = [];
for j = 1 : length(data_dir)
ReachData = ReadReachDataFunction(data_dir(j)+'/');
ncells = size(ReachData(1).A,2);
angle = [];
R2 = [];
FR = [];
Vis = 0;
for cells = 1 : ncells
[angle(cells,:), R2(cells)] = TuningLeastSquares(cells, ReachData,Vis);
[FR(cells,:), ~] = CellTuning(cells, ReachData,Vis);
end
pctCT = sum(R2 > .75)/ncells;
rawCT = sum(R2 > .75);
[a,b] = corr(angle');
c1 = a(:,1);
[ix,iy] = sort(c1)
figure()
title('cosine tuned cells with R2 over .75','FontSize',12)
hold on
Vis = 1
iter = 1
for i = 1 : ncells
if R2(i) >= .75 && iter < 10
CellTuning(i, ReachData,Vis)
iter = iter + 1
end
end
angle(R2<.75) = []
R2(R2<.75) = []
figure()
title('center reachout movement preference','FontSize',28)
xlabel('x','FontSize',14)
ylabel('y','FontSize',14)
hold on
uniquefrs = unique(angle)
for i = 1 : length(uniquefrs)
count(i) = sum(angle == uniquefrs(i))
end
%normalize
count = count/max(count)
[ii,ix] = max(count)
for i = 1 : length(uniquefrs)
if i == ix
plot([0,count(i)*cos(uniquefrs(i))],[0,count(i)*sin(uniquefrs(i))],'r',"LineWidth",3)
else
plot([0,count(i)*cos(uniquefrs(i))],[0,count(i)*sin(uniquefrs(i))],'k',"LineWidth",3)
end
end
store_r2(j) = pctCT;
store_raw(j) = rawCT;
end
figure();
bar(layer_count, store_r2);
title('cosine tuning by network layers','FontSize',28)
xlabel('number of layers in network','FontSize',14)
ylabel('cosine tuned percentage','FontSize',14)
figure();
bar(layer_count, store_raw);
title('total neurons cosine tuned','FontSize',28)
xlabel('number of layers in network','FontSize',14)
ylabel('cosine tuned neurons','FontSize',14)