-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowKernel.m
77 lines (70 loc) · 2.15 KB
/
showKernel.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
function f = showKernel(t_r, y_r, kernelInfo, cardinalDir)
%f = showKernel(t_r, y_r, kernelInfo, cardinalDir)
%
% 5/5/23 now compatible w both eye speed and position
useSameYrange = true;
if useSameYrange
absMax = max(cellfun(@(x)abs(max(x(:))), kernelInfo.kernel));
end
f = figure('position',[0 0 1000 500]);
subplot(1,2,1);
plot(t_r, y_r(:,1), 'color',[.5 .5 .5]);hold on
plot(t_r, y_r(:,2), 'linewidth',2);
xlim([100 200])
legend('recorded','fitted');
xlabel('time [s]'); ylabel('firing rate [Hz]');
title(['expval: ' num2str(kernelInfo.expval), ', R: ' num2str(kernelInfo.corrcoef)]);
a2=subplot(4,2,2);
thisIm = kernelInfo.kernel{1}';
crange = prctile(abs(thisIm(:)),99);
if useSameYrange
crange = absMax;
end
%crange = prctile(thisIm(:),[1 99]);
imagesc(kernelInfo.tlags{1}(:,1), cardinalDir, thisIm);
caxis([-crange crange]);
set(gca,'ytick',cardinalDir);
xlabel('time from targetOnset [s]');
mcolorbar(a2,.5);
a3=subplot(4,2,4);
thisIm = kernelInfo.kernel{2}';
crange = prctile(abs(thisIm(:)),99);
if useSameYrange
crange = absMax;
end
imagesc(kernelInfo.tlags{2}(:,1),cardinalDir, thisIm);
caxis([-crange crange]);
set(gca,'ytick',cardinalDir);
xlabel('time from eye movement [s]');
mcolorbar(a3,.5);
if numel(kernelInfo.kernel)==2
return;
elseif size(kernelInfo.kernel{3},2)>1
a4=subplot(4,2,6);
thisIm = kernelInfo.kernel{3}';
crange = prctile(abs(thisIm(:)),99);
if useSameYrange
crange = absMax;
end
imagesc(kernelInfo.tlags{3}(:,1),cardinalDir, thisIm);
caxis([-crange crange]);
set(gca,'ytick',cardinalDir);
xlabel('time from eye movement [s]');
mcolorbar(a4,.5);
a5=subplot(4,2,8);
plot(kernelInfo.tlags{4}, kernelInfo.kernel{4}');hold on
plot(kernelInfo.tlags{5}, kernelInfo.kernel{5}');hold on
xlabel('time from pupil dilation/blink [s]');
axis tight;
if useSameYrange
ylim([-absMax absMax]);
end
linkaxes([a2 a3 a4 a5],'x');
else
a4=subplot(4,2,8);
plot(kernelInfo.tlags{3}, kernelInfo.kernel{3}');hold on
plot(kernelInfo.tlags{4}, kernelInfo.kernel{4}');hold on
xlabel('time from pupil dilation/blink [s]');
axis tight;
linkaxes([a2 a3 a4],'x');
end