-
Notifications
You must be signed in to change notification settings - Fork 3
/
it_plotSmoothTFR_rett.m
127 lines (109 loc) · 3.2 KB
/
it_plotSmoothTFR_rett.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
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
%% plot TFR data. run after timeFreq_Rett.m
% Shlomit Beker shlomitbeker@gmail.com
figure;
if Group == 1
suptitle(' NT - instantaneous phase')
else
suptitle(' RETT instantaneous phase')
end
set(gca,'fontsize', 14);
hold on;
%%
for k = 1:6
% data is a matrix of frequency (rows) x time (columns)
TITLES = {'ISI 450 std','ISI 450 dev','ISI 900 std','ISI 900 dev','ISI 1800 std','ISI 1800 dev'};
clear Timeoi x y x2 y2 Data
N = 500;
timeReduction= 183:410;
%timeReduction = [length(timeoi)./5*2:length(timeoi)./4*3];
Timeoi = timeoi(round(timeReduction));
Data = data{k}(:,round(timeReduction)); %the original data (and time epoch) had too many Nans in it for the interpolation function.
[n, m] = size(Data);
[x,y] = meshgrid(Timeoi,freqoi); % low-res grid
[x2,y2] = meshgrid(Timeoi(1):1/N/5:Timeoi(end),freqoi(1):.01:freqoi(end)); %high-res grid
dataInterp = interp2(x,y,Data, x2,y2, 'linear'); %interpolate up
% if plotP == 1
% dataInterp = interp2(x,y,pVal, x2,y2, 'linear'); %interpolate up
% end
presOrder = [1,4,2,5,3,6];
subplot(2,3,presOrder(k))
figure;
f = surf(x2,y2,dataInterp);
%f=surf(x,y,data); %no interpolation
f.EdgeColor = 'none';
f.FaceColor = 'interp';
f.FaceLighting = 'gouraud';
set(gca,'ydir','normal')
%set(gca,'YScale','log');
% ylabel('Frequency, Hz (log)')
% xlabel('Time, Sec.')
% title(TITLES{k});
box on
colormap jet;
ax = gca;
caxis([0 0.3]);
%
% caxis(ax.CLim)
view(0,90)
yticks([2 5 10 15 20 25])
axis tight
hold on;
% stimuli lines
z = get(f,'ZData');
%set(f,'ZData',z-10);
z_max = max(max(get(f,'Zdata')));
%hold on;
% for k = 2:length(lines)
% line([lines(k), lines(k)],[y2(1,1),y2(end,1)],[z_max,z_max]...
% ,'Color','w','LineWidth',2,'LineStyle','--');
% end
end
%%
plotP = input(prompt);
promptK = 'choose K (1-6)';
if plotP ==1
figure('units','normalized','outerposition',[0 0 1 1])
subplot(4,4,[1 4 2 8])
h = imagesc(Timeoi(1):1/N/5:Timeoi(end),freqoi(1):.01:freqoi(end),dataInterp)
hold on;
dataInterp(isnan(dataInterp)==1)=1;
pSig = dataInterp <0.05;
[row,col,v] = find(pSig);
contour(Timeoi(1):1/N/5:Timeoi(end),freqoi(1):.01:freqoi(end),pSig,'k');
colormap jet;
colorbar;
caxis([-0.1 0.1]);
set(gca,'YDir','normal')
% for k = 2:length(lines)
% line([lines(k), lines(k)],[y2(1,1),y2(end,1)],[z_max,z_max]...
% ,'Color','w','LineWidth',2,'LineStyle','--');
% end
ylabel('Frequency (Hz)');
xlabel('Time (Sec.)');
title('TD-ASD ITPC difference')
set(gca,'fontsize', 14);
else
hold on;
subplot(3,3,[1 4])
%plot(mean(dataInterp,2),freqoi)
freqVec = freqoi(1):.01:freqoi(end);
%freqVec = freqoi(1):1/500/5:freqoi(end);
plot(mean(dataInterp,2),freqVec,'LineWidth',2);
axis tight
ylabel('Frequency, Hz')
xlabel('ITPC value')
set(gca,'fontsize', 12);
%%
hold on;
dataInterp(dataInterp==1) = NaN;
timeVec = Timeoi(1):1/N/5:Timeoi(end);
ax1 = subplot(4,4,[9, 12]);
area(ax1,timeVec, nanmean(dataInterp,1),'EdgeColor', 'none', 'FaceColor', [0.5 0.5 0.5]);
box off
xlabel('Time, sec.')
ylabel('ITPC value')
set(gca,'fontsize', 12);
axis tight
ylim([0 0.02]);
set(gca,'fontsize', 14);
end