-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_response_curve_PDF.m
66 lines (45 loc) · 2.22 KB
/
make_response_curve_PDF.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
% This assumes that data has already been loaded and is this file:
assert(contains(epochs.filename,'01_SQ1100NF565040423'))
n_cells = numel(epochs.SPIKE.clusters);
do_PDF = true;
plots.PDF_tools('setup',do_PDF);
for cell_id = 1:n_cells % for each cell_id
clf
p = get(gca,'position'); % default single axes
% this is the code which actually generates the plot
plots.responseCurve(epochs,'-per-unit','-chan',cell_id, '-x', ...
'average','-roi',[-0.05 0.2]); % see just this unit
% modify the axis position and x/y limits
set(gca,'position',p), axis tight, xlim([-0.1 10]), ylim(ylim);
xlabel('stimulus intensity') % was 'average'
h = get(gca,'children');
nD = length(findobj(h,'Type','ErrorBar')); % number of durations
for dur = 1:nD % make into small-replicates axes by handle manipulation
ax = copyobj(h(1).Parent,gcf); % original axes with all plots/data
ax.Position(2) = ax.Position(2) + (dur-1)*ax.Position(4)/(nD-0.5);
ax.Position(4) = ax.Position(4) / (nD+1);
cull = setdiff(1:numel(h),[dur numel(h)-1]); % this one and baseline
delete(ax.Children(cull))
if dur > 1 % remove axis ticks and labels
set(ax,'XTick',[],'YTickLAbel','')
ylabel(ax,''), xlabel(ax,'')
end
ax.Children(2).Color = [0 0 0 0.3]; % make feint grey
ax.Children(2).XData(1) = 0; % make go to zero
info = ax.Children(1).UserData; % get the stimulus info
% this is put there by the
text(max(xlim),ylim*[.1;.9], ...
sprintf('duration = %d ms', info.duration*1e3), ...
'FontSize',10,'Color',ax.Children(1).Color, ...
'Horiz','right','parent',ax)
end
delete(h(1).Parent)
suptitle(sprintf('[%d/%d] cell %d : channel %d, quality %d', ...
cell_id, n_cells, ...
data.SPIKE.sort_info(cell_id).clus, ...
data.SPIKE.sort_info(cell_id).ch, ...
data.SPIKE.sort_info(cell_id).quality))
pause(0.5)
plots.PDF_tools(gcf, do_PDF, 'page-%04d.ps', cell_id)
end
plots.PDF_tools('compile',do_PDF,'my-analysed-data (%d).pdf')