-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlabmeeting.m
109 lines (76 loc) · 3.4 KB
/
labmeeting.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% Figures for lab meeting
load rf5sync
set(0,'DefaultFigureColor',[1 1 1]);
ncells = length(rf.shape);
%% Plot RF Map
cvalid = rf.shape==19;
figure(1), clf;
plotrfmap(rf,'fignum',1,'showaxes',1,'showlabels',1,'cellvalid',cellvalid);
axis equal
set(gca,'XLim',[22.5 34.5],'XTick',22:34);
set(gca,'YLim',[15.5 26.5],'YTick',16:26);
print(1,'-depsc2','fig_rf5map')
%% Plot sample spike xcorr
twind = [ -0.06 -0.04;
-0.04 -0.02;
-0.02 0.0;
0.00 0.02;
0.02 0.04;
0.04 0.06; ];
nwind = size(twind,1);
cwind = flipud(copper(nwind+1));
cwind = cwind(1:nwind,:);
pairs = [1 2; 2 33; 9 14; 4 17; 20 21; 21 27];
for i = 1:size(pairs,1)
mvalid = zeros(ncells,1);
mvalid(pairs(i,1)) = 1;
mvalid(pairs(i,2)) = 1;
figure(1), clf;
plotrfmap(rf,'fignum',1,'showaxes',1,'showlabels',1,'cellvalid',mvalid);
axis equal
set(gca,'XLim',[22.5 34.5],'XTick',22:34);
set(gca,'YLim',[15.5 26.5],'YTick',16:26);
print(1,'-depsc2',['fig_rfmap' num2str(pairs(i,1)) 'v' num2str(pairs(i,2))]);
ca = ['c' num2str(pairs(i,1))];
cb = ['c' num2str(pairs(i,2))];
fname = ['fig_spikecorr' num2str(pairs(i,1)) 'v' num2str(pairs(i,2))];
generateSyncTimesPair(rf.(ca),rf.(cb),11,twind,cwind,'nearest');
print(11,'-depsc2',fname);
end
%% Generate sync spike proportion by pairs for different windows
cellvalid = rf.shape ~= 0 & ~isnan(rf.shape);
[pairProp propInPairCell cInPair] = syncSpikeProportionMap(rf,'twind',[-0.05 0.05], 'cellvalid', cellvalid);
print(20,'-depsc2','fig_syncpairprop50ms');
[pairProp propInPairCell cInPair] = syncSpikeProportionMap(rf,'twind',[-0.02 0.02], 'cellvalid', cellvalid);
print(20,'-depsc2','fig_syncpairprop20ms');
[pairProp propInPairCell cInPair] = syncSpikeProportionMap(rf,'twind',[-0.01 0.01], 'cellvalid', cellvalid);
print(20,'-depsc2','fig_syncpairprop10ms')
[pairProp propInPairCell cInPair] = syncSpikeProportionMap(rf,'twind',[-0.005 0.005], 'cellvalid', cellvalid);
print(20,'-depsc2','fig_syncpairprop5ms')
[pairProp propInPairCell cInPair] = syncSpikeProportionMap(rf,'twind',[-0.001 0.001], 'cellvalid', cellvalid);
print(20,'-depsc2','fig_syncpairprop1ms')
%% Generate syncpairrf maps for various pairs of cells
syncpairrf(rf,1,2,'justcells',0,'fignum',3,'plotprojcent',1,'useleadingspike',1)
print(3,'-depsc2','fig_syncpairrf1v2')
syncpairrf(rf,2,33,'justcells',0,'fignum',3,'plotprojcent',1,'useleadingspike',1)
print(3,'-depsc2','fig_syncpairrf2v33')
syncpairrf(rf,19,20,'justcells',0,'fignum',3,'plotprojcent',1,'useleadingspike',1)
print(3,'-depsc2','fig_syncpairrf19v20')
syncpairrf(rf,20,21,'justcells',0,'fignum',3,'plotprojcent',1,'useleadingspike',1)
print(3,'-depsc2','fig_syncpairrf20v21')
% change 2nd and 3rd args and image filename, etc...
%% Generate red cell adjacency grid with syncrf centers projected onto
% connecting vectors
rf.shape([28 19 30]) = 45; % set big red cells to purple (sensitizing)
projcentlength = syncadjacentrf(rf,'fignum',16,'shapevalid',19,...
'plotbidir',0,'plotcentlengths',2,'useleadingspike',1);
title('Synchronous RFs along Delaunay Triangulation Edges');
axis equal
set(gcf,'Position',[ 36 10 962 774]);
xlim([ 22.7806 33.1041]);
ylim([ 16.3356 25.9045]);
print(16,'-depsc2','fig_adjacentpairrf');
%% Scatter plots of normalized distance projected along connecting vectors
plotprojcentlength(rf,projcentlength,'fignum',51)
print(51,'-depsc2','fig_projcentscatter');
print(52,'-depsc2','fig_projcentsorted');