-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScienceFigure.m
More file actions
196 lines (150 loc) · 5.38 KB
/
ScienceFigure.m
File metadata and controls
196 lines (150 loc) · 5.38 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
function sciencefigure(cell_num,binsize,num_sub_bins)
% define some constants
% Position values are [left bottom width height]
pos1 = [.075 .35 .875 .625];
pos2 = [.075 .15 .875 .19];
pos3 = [.075 .1 .875 .04];
pos4 = [.075 .05 .875 .04];
% Loads the 3 files below and calls no other functions, must include a
% cell number, binsize for the psth and events, and the number of
% sub_bins for the tres score.
load jonsdisplayevents
load jonscellsdata
load jbcells
cell_ind = find(cell_numbers == cell_num);
rez = [3 5];
rez_ind = find(rez == binsize);
psth = displayevents(cell_ind).normalpsths{rez_ind};
threshold = displayevents(cell_ind).thresholds(rez_ind);
threshold2 = displayevents(cell_ind).thresholds2(rez_ind);
events = displayevents(cell_ind).mean_event_times{rez_ind};
pos_lim = displayevents(cell_ind).pos_limit{rez_ind};
neg_lim = displayevents(cell_ind).neg_limit{rez_ind};
psthline = displayevents(cell_ind).bin{rez_ind};
ss_event_ind = displayevents(cell_ind).ss_event_ind{rez_ind};
raster = jonscells(cell_ind).raster;
sc_num = jonscells(cell_ind).scene_changes;
frames = jonscells(cell_ind).frame_times;
rep_duration = jonscells(cell_ind).rep_duration;
frame_duration = jonscells(cell_ind).frame_duration;
num_repetition = jonscells(cell_ind).num_repetition;
figure
% turn double buffering on so updates will be faster
set(gcf,'DoubleBuffer','on');
% set(gcf,'Color',[1 1 1])
%%%%%%%PLOT THE RASTER%%%%%%%%%%%%%
%subplot('Position',[left bottom width height])
subplot('Position',pos1)
set(gca,'XAxisLocation','top')
for r = 1:num_repetition
if isempty(raster{r})
raster{r} = NaN;
end
hold on
% line([raster{r} raster{r}],[r+.5 r-.5],'Color','b','Linewidth',2)
plot(raster{r},r,'.k')
end
fram = frames(2:end);
%%%%%%%%%PLOT THE SCENE CHANGES %%%%%%%%%%%%%
for sc = 1:length(sc_num)
plot(fram(sc_num(sc)),num_repetition+1.5,'k^','LineWidth',2)
end
%%%%%%%%%%%%%% PLOT THE EVENTS %%%%%%%%%%%%%%%%%%%%%%
for f = 1:length(events)
line([events(f) events(f)],[num_repetition+3 num_repetition+4.5],'Color','k',...
'LineWidth',1.5)
end
%%%%%%%%%%%%%% PLOT THE FRAME MARKERS %%%%%%%%%%%%%%%%%%%
for f = 1:length(frames)
line([frames(f) frames(f)],[num_repetition+5 num_repetition+6.5],'Color','k',...
'LineWidth',1.5)
end
% %%%%%%%%%%%%%%%%%% PLOT THE EVENT BOUNDARIES %%%%%%%%%%%%%%%
%
%
% for f = 1:length(pos_lim)
%
% line([pos_lim(f)*binsize pos_lim(f)*binsize],[num_repetition+4 num_repetition+5.5],'Color','c',...
% 'LineWidth',4)
%
% line([neg_lim(f)*binsize neg_lim(f)*binsize],[num_repetition+4 num_repetition+5.5],'Color','c',...
% 'LineWidth',4)
% end
% ylabel('Repetitons')
% axis tight
liney = num_repetition + 7.5;
ylim([0 num_repetition+7.5])
% liney = num_repetition + 5;
% ylim([0 num_repetition+5.5])
line([0 rep_duration],[liney liney],'Color','k')
axis ij
set(gca,'box','off')
set(gca,'Tickdir','out')
set(gca,'XTickmode','manual'); set(gca,'XTick',[]);
set(gca,'XColor',[0 0 0])
set(gca,'YColor',[0 0 0])
set(gca,'YTick',[0:10:num_repetition]);
%%%%%%%%%%%%%% SUBPLOT 2 %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% PLOT THE PSTH AND THRESHOLD %%%%%%%%%%%%%%%%
subplot('Position',pos2)
stairs(psthline,psth,'k')
% ylabel('FR')
hold on
plot([0 rep_duration],[threshold threshold],'--k')
% hold on
plot([0 rep_duration],[threshold2 threshold2],'--k')
axis tight
set(gca,'box','off')
set(gca,'Tickdir','out')
% set(gca,'XTickmode','manual');
set(gca,'XTick',[]);
set(gca,'YTick',[50 100 150]);
% set(gca,'XAxisLocation','top')
set(gca,'XColor',[1 1 1])
set(gca,'YColor',[0 0 0])
%%%%%%%%%%%%%% SUBPLOT 3 %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% GET THE FANO FACTOR INFO %%%%%%%%%%%%%%%%
fano = jonscells(cell_ind).fanofactor;
msc = jonscells(cell_ind).meanspikecount;
msc_ind = find(msc<1);
fano(msc_ind) = NaN;
% fano_ind = find(fano>=5);
% fano(fano_ind) = 5;
%%%%%%%%%%%%% PLOT THE FANO FACTOR %%%%%%%%%%%%%%%%
subplot('Position',pos3)
hb = bar(frames(1:end-1)+(frame_duration/2),fano,'k');
% vert=get(hb,'vertices');
% vert(vert==0) = floor(min(fano)*100)/100;
% set(hb,'vertices',vert);
% set(gca,'yscale','log','ytick',[(floor(min(fano)*10)/10):.1:1 2:1:5]);
% set(gca,'yscale','log','ytick',[.3:.2:.9]);
ylim([0.4 1])
set(gca,'YTick',[0.6 1]);
hold on
line([0 rep_duration],[1 1],'Color','k')
% ylabel('FF')
% axis tight
set(gca,'box','off')
set(gca,'Tickdir','out')
% set(gca,'XTickmode','manual');
set(gca,'XTick',[]);
set(gca,'XColor',[1 1 1])
set(gca,'YColor',[0 0 0])
%%%%%%%%%%%%%% SUBPLOT 4 %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% PLOT THE TRES SCORE %%%%%%%%%%%%%%%%%%
sub_bins = [10 6 3 2];
nsb = find(sub_bins == num_sub_bins);
tres = jonscells(cell_ind).tresscores{nsb};
tres(msc_ind) = NaN;
subplot('Position',pos4)
bar(frames(1:end-1)+(frame_duration/2),tres,'k')
% ylabel('TRES')
% axis tight
set(gca,'box','off')
set(gca,'Tickdir','out')
% xlabel('Time (msec)')
ylim([50 100])
set(gca,'YTick',[50 100])
set(gca,'XColor',[0 0 0])
set(gca,'YColor',[0 0 0])
% print -dtiff sciencefig1b.tiff