Skip to content

Commit 1f08465

Browse files
committed
merge from develop for new release
2 parents cf4cb67 + 4b60c5f commit 1f08465

29 files changed

+3466
-1120
lines changed

README.md

Lines changed: 119 additions & 96 deletions
Large diffs are not rendered by default.

comodulogram.m

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
function h = comodulogram(freqs_phase,freqs_amp,pacval,varargin)
2+
icadefs;
3+
h = [];
4+
if nargin < 3
5+
help comodulogram;
6+
return;
7+
end
8+
9+
g = finputcheck( varargin, { ...
10+
'signifmask' 'integer' [ ] [];
11+
'alphadata' 'integer' [] 0.5;
12+
'title' 'string' '' 'Modulation Index';
13+
'shading' 'string' {'flat', 'faceted'} 'flat';
14+
'scale' 'string' {'linear' 'log'} 'log'});
15+
16+
h = figure('Name', g.title,'Units','Normalized','Tag','comod_plot');
17+
haxes = axes('parent',h,'Units', 'Normalized','ActivePositionProperty', 'outerposition');
18+
pcolor(freqs_amp, freqs_phase, pacval);
19+
% shading(haxes,g.shading); % shading data
20+
colormap(haxes,'parula'); % Colormap
21+
22+
% Scale
23+
if strcmp(g.scale, 'log')
24+
set(haxes, 'XScale', 'log');
25+
set(haxes, 'YScale', 'log');
26+
else
27+
set(haxes, 'XScale', 'linear');
28+
set(haxes, 'YScale', 'linear');
29+
end
30+
31+
title(haxes, sprintf(g.title)); % Title
32+
colorbar(haxes); % colorbar
33+
34+
% Axis labels
35+
xlabel(haxes,'Phase Frequency [Hz]');
36+
ylabel(haxes,'Amplitude Frequency [Hz]');
37+
set(get(h,'Children'),'Fontsize',AXES_FONTSIZE_L+5);
38+
39+
% Plot significance mask
40+
if ~isempty(g.signifmask)
41+
haxes2 = axes('Position',haxes.Position,'XTick',[],'YTick',[],'XTickLabel','','YTickLabel','');
42+
haxes2.ActivePositionProperty = 'outerposition';
43+
haxes2.Visible = 'off'
44+
linkaxes([haxes,haxes2]);
45+
h_trans = pcolor(freqs_amp,freqs_phase,int8(g.signifmask), 'parent', haxes2);
46+
47+
if strcmp(g.scale, 'log')
48+
set(haxes2, 'XScale', 'log');
49+
set(haxes2, 'YScale', 'log');
50+
else
51+
set(haxes2, 'XScale', 'linear');
52+
set(haxes2, 'YScale', 'linear');
53+
end
54+
set(h_trans,'FaceAlpha',g.alphadata);
55+
set(haxes2,'Color','None','XTick',[],'YTick',[],'XTickLabel','','YTickLabel','')
56+
colormap(haxes,'parula');
57+
colormap(haxes2,'gray');
58+
end
59+
box on; grid on;
60+
end

comodulogramt.m

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
function h = comodulogramt(freqs_phase,freqs_amp,timevect, pacval, varargin)
2+
3+
icadefs;
4+
h = [];
5+
if nargin < 4
6+
help comodulogramt;
7+
return;
8+
end
9+
10+
DefaultTitle = 'Modulation Index';
11+
ZLabelDefault = 'Phase Frequency (Hz)';
12+
YLabelDefault = 'Amplitude Frequency (Hz)';
13+
XLabelDefault = 'Latency(sec)';
14+
CBarLabelDefault = 'Modulation Index';
15+
g = finputcheck( varargin, { ...
16+
'npoints' 'integer' [2 length(timevect) ] 20;
17+
'times' 'integer' [] [];
18+
'title' 'string' '' DefaultTitle;
19+
'zlabel' 'string' '' ZLabelDefault;
20+
'ylabel' 'string' '' YLabelDefault;
21+
'xlabel' 'string' '' XLabelDefault;
22+
'cbartext' 'string' '' CBarLabelDefault;
23+
'comodtazimuth' 'integer' [] -10;
24+
'comodtelevation' 'integer' [] 23;
25+
'facealpha' 'integer' [] 0.5;
26+
'scale' 'string' {'linear' 'log'} 'log'});
27+
% Determining nearest time
28+
if isempty(g.times)
29+
times = min(timevect):((max(timevect)-min(timevect))/(g.npoints-1)):max(timevect);
30+
else
31+
times = g.times;
32+
end
33+
[~, timeidx] = min(abs(repmat(timevect,length(times),1)-repmat(times',1,length(timevect))),'',2);
34+
tplot = timevect(timeidx);
35+
36+
%% Plotting start here
37+
38+
h = figure('Name', g.title,'Units','Normalized','Position', [0.2349 0.3093 0.5547 0.2907],'Tag','comodt_plot');
39+
haxes = axes('Units', 'Normalized','Color','None','parent', h);
40+
41+
% Plot
42+
Z = pacval(:,:,timeidx);
43+
[M,N,P] = size(Z);
44+
for i=1:P
45+
% Create a plane at x=i
46+
hsurf = surface(tplot(i)*ones(1,M),1:N,repmat([M:-1:1],N,1),repmat([M:-1:1],N,1));
47+
% set the color of the plane to be the image
48+
set(hsurf,'CData', flipud(Z(:,:,i))');
49+
% set some extra properties
50+
set(hsurf,'EdgeColor','none');
51+
alpha(g.facealpha)
52+
end
53+
54+
% Makeup
55+
% set the viewing angle
56+
view(g.comodtazimuth, g.comodtelevation)
57+
axis tight; grid on;
58+
h_ylabel = ylabel(g.ylabel,'FontSize',AXES_FONTSIZE_L,'FontWeight','bold','Units','Normalized');
59+
h_zlabel = zlabel(g.zlabel,'FontSize',AXES_FONTSIZE_L,'FontWeight','bold','Units','Normalized');
60+
h_xlabel = xlabel(g.xlabel,'FontSize',AXES_FONTSIZE_L,'FontWeight','bold','Units','Normalized');
61+
62+
set(haxes,'Color','None');
63+
64+
% Y axis labels
65+
ylabel_val = freqs_amp(get(haxes,'YTick'));
66+
for i = 1:length(ylabel_val)
67+
ylabel_string{i} = sprintf('%1.1f',ylabel_val(i));
68+
end
69+
set(haxes,'YTickLabel', ylabel_string,'FontSize',AXES_FONTSIZE_L);
70+
71+
% Z axis label
72+
zlabel_val = freqs_phase(get(haxes,'ZTick'));
73+
for i = 1:length(zlabel_val)
74+
zlabel_string{i} = sprintf('%1.1f',zlabel_val(i));
75+
end
76+
set(haxes,'ZTickLabel', zlabel_string);
77+
78+
% X axis label
79+
set(haxes,'XTick', tplot);
80+
for i = 1:length(tplot)
81+
xlabel_string{i} = sprintf('%1.2f',tplot(i));
82+
end
83+
set(haxes,'XTickLabel', xlabel_string);
84+
85+
% Title
86+
title(g.title,'FontSize',AXES_FONTSIZE_L,'FontWeight','bold');
87+
88+
% colorbar
89+
hbar = colorbar;
90+
set(get(hbar,'Label'),'String',g.cbartext);
91+
end
92+

doc/img/demo1_pop_pac2.jpg

175 KB
Loading

doc/img/pop_pac_gui2.jpg

174 KB
Loading

doc/img/pop_plotpac_demo.jpg

2.65 MB
Loading

doc/img/pop_plotpac_gui2.jpg

365 KB
Loading

0 commit comments

Comments
 (0)