-
Notifications
You must be signed in to change notification settings - Fork 0
/
SM_PlotWithSonogramSummedData.m
50 lines (39 loc) · 1.5 KB
/
SM_PlotWithSonogramSummedData.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
%% VARIABLES
% load saved variables into the workspace first:
% load roi_ave
% and the output matrix from plot summed videos
% and the stimulus: SONG = audioread('filename');
sonogram_comptime = 150; % frame at which song started playing
comptime = 10; % frames clipped from beginning and compensated in graph
data_to_plot = summed_dffvideos; % matrix from which data is grabbed
fs = 48000;
shiftupValue = 0.08;
startTime = (1*(1/framerate));
endTime = (Frames*(1/framerate));
%% Plot sonogram
[b,a] = ellip(5,.2,80,[500]/(fs/2),'high');
[IMAGE,F,T] = fb_pretty_sonogram(filtfilt(b,a,SONG./abs(max(SONG))),fs,'low',1.5,'zeropad',0);
figure()
h(1) = subplot(10,1,1:2);
imagesc((sonogram_comptime+T*framerate-startTime*framerate+1)/framerate,F,log(abs(IMAGE)+1e+2));set(gca,'YDir','normal');
colormap(flipud(bone)*.8)
freezeColors;
ylim([0 9000]);
hold on
h(2) = subplot(10,1,3:10);
hold on
%% Plot ROI data
counter = 1;
c = colormap(lines(50));
for ROIiter = 1:ROIS
dataPerROI = data_to_plot(ROIiter,:); % Only when using summed matrix (not when multiple matrix)
shiftup = (shiftupValue*counter-1);
plot(((((comptime+(1:length(dataPerROI)))))/framerate),dataPerROI+shiftup,'Color',c(ROIiter,:),'LineWidth',1.0);
counter=counter+1;
end
%% Some more figure stuff
ylabel('');
xlabel('Time (s)');
set(findall(gcf,'type','text'),'FontSize',13,'fontWeight','bold')
linkaxes(h,'x');
xlim([0 ((comptime+BOStime)/framerate)]);