-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContoursPlotSpikes.m
More file actions
125 lines (116 loc) · 3.96 KB
/
ContoursPlotSpikes.m
File metadata and controls
125 lines (116 loc) · 3.96 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
function ContoursPlotSpikes(spikes,cluster,target,argcatch)
%ContoursPlotSpikes Plot spike trains according to salience conditions
% ContoursPlotSpikes(SPIKES,CLUSTER,TARGET,CATCH) creates
% rasterplots of the response grouped according to salience values.
% TARGET is either 'contour' for the contour target, or 'control'
% for the control target. CATCH is either 'allcatch', which means to
% plot the responses to all the catch trials, 'catch' which means to
% plot the catch trials according to locations or 'nocatch' which
% means not to plot the responses to the catch trials.
% e.g. ContoursPlotUnleavedSpikes(annie042401s08g01us,1,'contour',
% 'catch') plots the spikes in cluster number 1 for the
% trials where the target was at the contour location.
% The response to the catch trials are also plottted.
if strcmp(argcatch,'catch')
plotcatch = 1;
elseif strcmp(argcatch,'nocatch')
plotcatch = 0;
elseif strcmp(argcatch,'allcatch')
plotcatch = 2;
end
saliencesteps = size(spikes.contour,2);
y = 0;
salienceboundary = [];
if strcmp(target,'contour')
% plot contour conditions
for si=1:saliencesteps
reps = size(spikes.contour(si).repetition,2);
for ri=1:reps
yend = y + 0.75;
for spi=1:spikes.contour(si).repetition(ri).cluster(cluster).spikecount
spiketime = spikes.contour(si).repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
end
if plotcatch==1
catchreps = size(spikes.catchcontour.repetition,2);
for ri=1:catchreps
yend = y + 0.75;
for spi=1:spikes.catchcontour.repetition(ri).cluster(cluster).spikecount
spiketime = spikes.catchcontour.repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
end
elseif strcmp(target,'control')
% plot control conditions
for si=1:saliencesteps
reps = size(spikes.control(si).repetition,2);
for ri=1:reps
yend = y + 0.75;
for spi=1:spikes.control(si).repetition(ri).cluster(cluster).spikecount
spiketime = spikes.control(si).repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
end
if plotcatch==1
catchreps = size(spikes.catchcontrol.repetition,2);
for ri=1:catchreps
yend = y + 0.75;
for spi=1:spikes.catchcontrol.repetition(ri).cluster(cluster).spikecount
spiketime = spikes.catchcontrol.repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
end
end
if plotcatch==2
if isfield(spikes,'allcatch')
catchreps = size(spikes.allcatch.repetition,2);
for ri=1:catchreps
yend = y + 0.75;
for spi=1:spikes.allcatch.repetition(ri).cluster(cluster).spikecount
spiketime = spikes.allcatch.repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
else
catchreps = size(spikes.catchcontour.repetition,2);
for ri=1:catchreps
yend = y + 0.75;
for spi=1:spikes.catchcontour.repetition(ri).cluster(cluster).spikecount
spiketime = spikes.catchcontour.repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
catchreps = size(spikes.catchcontrol.repetition,2);
for ri=1:catchreps
yend = y + 0.75;
for spi=1:spikes.catchcontrol.repetition(ri).cluster(cluster).spikecount
spiketime = spikes.catchcontrol.repetition(ri).cluster(cluster).spikes(spi);
line([spiketime spiketime],[y yend])
end
y = y + 1;
end
salienceboundary = [salienceboundary y];
end
end
% get axis values so we can draw the lines separating conditions
axi = axis;
bsteps = size(salienceboundary,2);
for si=1:bsteps
line([axi(1) axi(2)],[salienceboundary(si) salienceboundary(si)])
end