-
Notifications
You must be signed in to change notification settings - Fork 2
/
OptoRawTrace.m
56 lines (50 loc) · 2.32 KB
/
OptoRawTrace.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
function OptoRawTrace(recTrace,spikeTimes,msConv,TTLtimes,pulseDur,option,axisHandle)
if ~exist('axisHandle','var') | isempty(axisHandle)
figure('Position',[1092 149 708 761]); hold on
end
cmap=parula;
%plot raw trace
if size(recTrace.data,1)>1
for traceNum=1:size(recTrace.data,1)
plot(zscore(recTrace.data(traceNum,:))+15*(traceNum-1)+... %+max(get(gca,'ylim'))
max(abs(zscore(recTrace.data(traceNum,:)))),'color','k');
end
else
plot(recTrace.data,'color','k');
end
if ~isempty(TTLtimes)
for TTLNum=1:length(TTLtimes)
patch([TTLtimes(TTLNum), TTLtimes(TTLNum),...
TTLtimes(TTLNum)+pulseDur*msConv, TTLtimes(TTLNum)+pulseDur*msConv], ...
[get(gca,'ylim') fliplr(get(gca,'ylim'))], ...
[0 0 0 0],[0.3 0.75 0.93],'EdgeColor','none','FaceAlpha',0.7);
end
if strcmp(option,'center') %length(TTLtimes)==1
set(gca,'xlim',[TTLtimes(end)-50*msConv TTLtimes(end)+200*msConv])
set(gca,'xtick',TTLtimes(end)-50*msConv:10*msConv:TTLtimes(end)+200*msConv,...
'xticklabel',-50:10:200);
set(gca,'ytick',[],'yticklabel',[],'TickDir','out');
else
% set(gca,'xtick',recTrace.xTicks,'xticklabel',recTrace.xTicklabels,...
% 'ytick',[],'yticklabel',[],'TickDir','out');
set(gca,'xtick',linspace(0,2*recTrace.excerptSize,9),...
'xticklabel',round(linspace(0,2*recTrace.excerptSize,9)/double(msConv),2),...
'ytick',[],'yticklabel',[],'TickDir','out');
end
end
box off;
xlabel('Time (ms)');
set(gca,'Color','white','FontSize',10,'FontName','Calibri');
for cellNum=1:length(spikeTimes)
if ~isempty(spikeTimes{cellNum}) & ~isnan(spikeTimes{cellNum})
%plot spike id labels
spkLabelYLoc=ones(1,size(spikeTimes{cellNum},2))*(min(get(gca,'ylim'))/4*3);
plot(double(spikeTimes{cellNum}), ...%-double(recTrace.location-recTrace.excerptSize),...
spkLabelYLoc,'Color',[cmap(cellNum,:),0.4],...
'linestyle','none','Marker','^');
% plot unit markers
% plot(spkTimes{unitP}-(handles.rawDataInfo.excerptLocation-handles.rawDataInfo.excerptSize),...
% rasterHeight,'Color','k',...
% 'linestyle','none','Marker','*');
end
end