Skip to content

Commit 38f79b9

Browse files
author
Cove Sturtevant
committed
Add files via upload
Part 4
1 parent f383601 commit 38f79b9

95 files changed

Lines changed: 21046 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
function display_figures(figure_list, output_mode, output_dir)
2+
% display_figures -- Display figure scripts to screen or write to file
3+
%
4+
5+
% $Id: display_figures.m 580 2005-09-13 05:50:42Z ccornish $
6+
7+
default_output_mode = 'screen';
8+
default_output_dir = './images';
9+
10+
default_image_format_list = {'jpeg', 'epsc'};
11+
12+
[default_figure_list] = textread('figure_list', '%s');
13+
14+
if ( ~exist('figure_list', 'var') || isempty(figure_list))
15+
figure_list = default_figure_list;
16+
end
17+
18+
if ( ~exist('output_mode', 'var') || ~isempty(output_mode))
19+
output_mode = default_output_mode;
20+
end
21+
22+
if ( ~exist('output_dir', 'var') || ~isempty(output_dir))
23+
output_dir = default_output_dir;
24+
end
25+
26+
image_format_list = default_image_format_list;
27+
28+
if (strcmp(output_mode, 'screen'))
29+
visible = 'on';
30+
else
31+
visible = 'off';
32+
end
33+
34+
35+
for (ifig = 1:length(figure_list))
36+
fig_name = figure_list{ifig};
37+
disp(['Running ', fig_name, '...']);
38+
hfigure = figure('Name', fig_name, 'Visible', visible);
39+
40+
eval(['run ', fig_name]);
41+
42+
switch output_mode
43+
case 'screen'
44+
disp('Pausing ... Hit any key to continue.');
45+
pause;
46+
case 'file'
47+
for (ifor = 1:length(image_format_list))
48+
out_format = image_format_list{ifor};
49+
out_filename = [output_dir, filesp, fig, '.', out_format];
50+
try
51+
print(['-d', out_format], out_filename);
52+
catch
53+
disp(['Error encountered while printing format ', out_format]);
54+
end
55+
end
56+
otherwise
57+
end
58+
59+
close(hfigure);
60+
end
61+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
% figure098a - Calculate and plot equivalent D(4) wavelet and scaling filters.
2+
%
3+
% Usage:
4+
% figure098a
5+
%
6+
7+
% $Id: figure098a.m 303 2004-03-25 23:40:38Z ccornish $
8+
9+
plot_equivalent_filter('DWT', 'd6', 7);
10+
11+
figure_datestamp(mfilename, gcf);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
% figure098b - Calculate and plot equivalent LA(8) wavelet and scaling filters.
2+
%
3+
% Usage:
4+
% figure098b
5+
%
6+
7+
% $Id: figure098b.m 353 2004-06-14 20:53:21Z ccornish $
8+
9+
plotOpts.PlotAutoCorrelationWidth = 0;
10+
11+
plot_equivalent_filter('DWT', 'la8', 7, ...
12+
'', '', ...
13+
'', '', plotOpts);
14+
15+
figure_datestamp(mfilename, gcf);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
% figure099 - Calculate and plot squared gain functiosn of DWT LA(8) filters.
2+
%
3+
% Usage:
4+
% figure099
5+
%
6+
7+
% $Id: figure099.m 353 2004-06-14 20:53:21Z ccornish $
8+
9+
plot_filter_sgf('DWT', 'la8', 4);
10+
11+
figure_datestamp(mfilename, gcf);
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
% figure126 - Calculate and plot partial DWT coefficients W of level J0 = 6 for
2+
% ECG time series using Harr, D(4), C(6) and LA(8) wavelets.
3+
%
4+
% Usage:
5+
% figure126
6+
%
7+
8+
% $Id: figure126.m 569 2005-09-12 19:37:21Z ccornish $
9+
10+
% Load the data
11+
[X, x_att] = wmtsa_data('ecg');
12+
13+
% Calculate DWT coefficient vectors
14+
J0 = 6;
15+
boundary = 'periodic';
16+
opts.RetainVJ = 0;
17+
18+
[WJ_haar, VJ_haar, att_haar, NJ_haar] = dwt(X, 'Haar', J0, 'periodic', opts);
19+
[WJ_d4, VJ_d4, att_d4, NJ_d4] = dwt(X, 'd4', J0, 'periodic', opts);
20+
[WJ_c6, VJ_c6, att_c6, NJ_c6] = dwt(X, 'c6', J0, 'periodic', opts);
21+
[WJ_la8, VJ_la8, att_la8, NJ_la8] = dwt(X, 'la8', J0, 'periodic', opts);
22+
23+
[W_haar] = dwt2vector(WJ_haar, VJ_haar, att_haar);
24+
[W_d4] = dwt2vector(WJ_d4, VJ_d4, att_d4);
25+
[W_c6] = dwt2vector(WJ_c6, VJ_c6, att_c6);
26+
[W_la8] = dwt2vector(WJ_la8, VJ_la8, att_la8);
27+
28+
29+
% Plot the DWT coefficients vectors
30+
nsubplots = 4;
31+
32+
XLim = [0, 2048];
33+
XTick = [0, 512, 1024, 1536, 2048];
34+
XTickLabel = XTick;
35+
36+
YLim = [-4, 4];
37+
YTick = [-4, 0, 4];
38+
YTickLabel = YTick;
39+
40+
axesProp.XLim = XLim;
41+
axesProp.XTick = XTick;
42+
axesProp.XTickLabel = XTickLabel;
43+
axesProp.YLim = YLim;
44+
axesProp.YTick = YTick;
45+
axesProp.YTickLabel = YTickLabel;
46+
axesProp.YMinorTick = 'off';
47+
48+
49+
plotOpts.labelSubvectors = 1;
50+
plotOpts.subvectorLabels = zeros(J0+1, 1);
51+
plotOpts.subvectorLabels(1:4) = [1:4];
52+
plotOpts.subvectorLabels(J0+1) = J0;
53+
54+
subplot(nsubplots, 1, 1);
55+
[haxes, hlineDWT, hlineBdry] = plot_dwt_vector(W_haar, NJ_haar, '', '', axesProp, ...
56+
plotOpts);
57+
htext = ylabel('Haar');
58+
set(htext, 'Rotation', 0, ...
59+
'HorizontalAlignment', 'right', ...
60+
'VerticalAlignment', 'middle');
61+
hold on;
62+
63+
plotOpts.labelSubvectors = 0;
64+
65+
subplot(nsubplots, 1, 2);
66+
[haxes, hlineDWT, hlineBdry] = plot_dwt_vector(W_d4, NJ_d4, '', '', axesProp, ...
67+
plotOpts);
68+
htext = ylabel('D(4)');
69+
set(htext, 'Rotation', 0, ...
70+
'HorizontalAlignment', 'right', ...
71+
'VerticalAlignment', 'middle');
72+
hold on;
73+
74+
subplot(nsubplots, 1, 3);
75+
[haxes, hlineDWT, hlineBdry] = plot_dwt_vector(W_c6, NJ_c6, '', '', axesProp, ...
76+
plotOpts);
77+
htext = ylabel('C(6)');
78+
set(htext, 'Rotation', 0, ...
79+
'HorizontalAlignment', 'right', ...
80+
'VerticalAlignment', 'middle');
81+
hold on;
82+
83+
subplot(nsubplots, 1, 4);
84+
[haxes, hlineDWT, hlineBdry] = plot_dwt_vector(W_la8, NJ_la8, '', '', axesProp, ...
85+
plotOpts);
86+
htext = ylabel('LA(8)');
87+
set(htext, 'Rotation', 0, ...
88+
'HorizontalAlignment', 'right', ...
89+
'VerticalAlignment', 'middle');
90+
hold on;
91+
92+
title_str = ...
93+
{['Figure 126.'], ...
94+
['Partial DWT coefficients W for J0 = 6'], ...
95+
['for ECG time series'], ...
96+
['using Harr, D(4), C(6) and LA(8) wavelets.']};
97+
98+
suptitle(title_str);
99+
100+
figure_datestamp(mfilename, gcf);
101+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
% figure183 - Calculate and plot MODWT coefficients of ECG time series to replicate Figure 183 of WMTSA.
2+
%
3+
% Usage:
4+
% figure183
5+
%
6+
7+
% $Id: figure183.m 599 2005-10-04 22:46:44Z ccornish $
8+
9+
% Load the data
10+
[X, x_att] = wmtsa_data('ecg');
11+
12+
% Compute MODWT coefficients
13+
wtfname = 'la8';
14+
J0 = 6;
15+
% boundary = 'reflection';
16+
boundary = 'periodic';
17+
18+
[WJt, VJt, att] = modwt(X, wtfname, J0, boundary);
19+
20+
% Setup time axis
21+
delta_t = 1 / 180; % sampling interval in seconds
22+
time_offset = 0.31; % seconds
23+
xaxis = (1:length(X)) * delta_t + time_offset;
24+
xlabel_str = 't (seconds)';
25+
26+
% Setup plotting parameters
27+
title_str = {};
28+
title_str(1) = {'\bfFigure 183.\rm MODWT wavelet analysis of ECG time series'};
29+
title_str(2) = {['Wavelet: ' wtfname ', NLevels: ', int2str(J0), ...
30+
', Boundary: ', boundary]};
31+
32+
XplotAxesProp.XLim = [0 12];
33+
XplotAxesProp.XTick = [0:1:12];
34+
XplotAxesProp.XTickLabel = [0:1:12];
35+
36+
MRAplotAxesProp.XLim = XplotAxesProp.XLim;
37+
MRAplotAxesProp.XTick = XplotAxesProp.XTick;
38+
MRAplotAxesProp.XTickLabel = XplotAxesProp.XTickLabel;
39+
40+
XplotAxesProp.YLim = [-1.5 1.5];
41+
XplotAxesProp.YTick = [-1.5 -.5 .5 1.5];
42+
XplotAxesProp.YTickLabel = [-1.5 -.5 .5 1.5];
43+
44+
% Plot MODWT coefficients
45+
46+
[hWplotAxes, hXplotAxes] = plot_modwt_coef(WJt, VJt, X, att, ...
47+
title_str, xaxis, xlabel_str, ...
48+
MRAplotAxesProp, XplotAxesProp);
49+
50+
figure_datestamp(mfilename, gcf);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
% figure184 - Calculate and plot MODWT MRA of ECG time series to replicate Figure 184 of WMTSA.
2+
%
3+
% Usage:
4+
% figure184
5+
%
6+
7+
% $Id: figure184.m 569 2005-09-12 19:37:21Z ccornish $
8+
9+
% Load the data
10+
[X, x_att] = wmtsa_data('ecg');
11+
12+
% Compute MODWT coefficients
13+
wtfname = 'la8';
14+
J0 = 6;
15+
boundary = 'reflection';
16+
[WJt, VJt, att] = modwt(X, wtfname, J0, boundary);
17+
18+
% Compute inverse MODWT MRA reconstruction.
19+
[DJt, SJt] = imodwt_mra(WJt, VJt, att);
20+
21+
% Setup x-axis for plotting.
22+
delta_t = 1 / 180; % sampling interval in seconds
23+
time_offset = 0.31; % seconds
24+
xaxis = (1:length(X)) * delta_t + time_offset;
25+
xlabel_str = 't (sec)';
26+
27+
% Setup plotting parameters
28+
title_str = {};
29+
title_str(1) = {'\bfFigure 184.\rm MODWT multiresolution analysis of ECG time series'};
30+
title_str(2) = {['Wavelet: ' wtfname ', NLevels: ', int2str(J0), ...
31+
', Boundary: ', boundary]};
32+
33+
XplotAxesProp.XLim = [0 12];
34+
XplotAxesProp.XTick = [0:1:12];
35+
% XplotAxesProp.XTickLabel = [0:2:12];
36+
% XplotAxesProp.XMinorTick = 'off';
37+
38+
XplotAxesProp.YLim = [-1.5 1.5];
39+
XplotAxesProp.YTick = [-1.5 -.5 .5 1.5];
40+
XplotAxesProp.YTickLabel = [-1.5 -.5 .5 1.5];
41+
42+
% Plot MRA coefficients
43+
44+
[hMRAplotAxes, hXplotAxes] = plot_imodwt_mra(DJt, SJt, X, att, ...
45+
title_str, xaxis, xlabel_str, ...
46+
[], XplotAxesProp);
47+
48+
figure_datestamp(mfilename, gcf);
49+
50+
51+
52+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
% figure186 - Calculate and plot MODWT MRA for Crescent City subtidal variations to replicate Figure 186 of WMTSA.
2+
%
3+
% Usage:
4+
% figure186
5+
%
6+
7+
% $Id: figure186.m 569 2005-09-12 19:37:21Z ccornish $
8+
9+
% Load the data
10+
[X, x_att] = wmtsa_data('subtidal');
11+
12+
% Compute MODWT coefficients
13+
wtfname = 'la8';
14+
J0 = 7;
15+
boundary = 'reflection';
16+
17+
[WJt, VJt, att] = modwt(X, wtfname, J0, boundary);
18+
19+
% Compute inverse MODWT MRA reconstruction.
20+
[DJt, SJt] = imodwt_mra(WJt, VJt, att);
21+
22+
% Setup x-axis for plotting.
23+
% Sample interval is 1/2 day -- Convert to years
24+
delta_t = .5 / 365;
25+
% Start time is 0800 PST 6 Jan 1980 = 1980 + 6.333333 days
26+
time_offset = 1980 + 6.33333 / 365;
27+
xaxis = (1:length(X)) * delta_t + time_offset;
28+
xlabel_str = 'years';
29+
30+
% Setup plotting parameters
31+
title_str = {};
32+
title_str(1) = {['\bfFigure 186.\rm MODWT multiresolution analysis ', ...
33+
'for CrescentCity subtidal variations']};
34+
title_str(2) = {['Wavelet: ' wtfname ', NLevels: ', int2str(J0), ...
35+
', Boundary: ', boundary]};
36+
37+
XplotAxesProp.XLim = [1980, 1992];
38+
XplotAxesProp.XTick = [1980:1:1992];
39+
XplotAxesProp.XTickLabel = [1980:1:1992];
40+
41+
XplotAxesProp.YLim = [-40 80];
42+
XplotAxesProp.YTick = [-40:20:80];
43+
XplotAxesProp.YTickLabel = [-40:20:80];
44+
45+
MRAplotAxesProp.XLim = XplotAxesProp.XLim;
46+
MRAplotAxesProp.XTick = XplotAxesProp.XTick;
47+
MRAplotAxesProp.XTickLabel = XplotAxesProp.XTickLabel;
48+
49+
% Plot MRA coefficients
50+
51+
[hMRAplotAxes, hXplotAxes] = plot_imodwt_mra(DJt, SJt, X, att, ...
52+
title_str, xaxis, xlabel_str, ...
53+
MRAplotAxesProp, XplotAxesProp);
54+
55+
56+
% Plot overlay of lines marking start of years 1981-1991
57+
year_range = [1981:1:1991];
58+
x1 = year_range;
59+
x2 = year_range;
60+
61+
lineProp.Color = 'green';
62+
lineProp.LineWidth = .35;
63+
lineProp.LineStyle = '--';
64+
65+
66+
% Plot overlay on MRA plot.
67+
ylim = get(hMRAplotAxes, 'YLim');
68+
y1 = ylim(1) * ones(length(x1),1);
69+
y2 = ylim(2) * ones(length(x1),1);
70+
71+
set(get(hMRAplotAxes, 'Parent'), 'CurrentAxes', hMRAplotAxes);
72+
73+
linesegment_plot(x1, y1, x2, y2, lineProp);
74+
linesegment_plot(x1, y1, x2, y2, lineProp);
75+
76+
% Plot overlay on X plot.
77+
ylim = get(hXplotAxes, 'YLim');
78+
y1 = ylim(1) * ones(length(x1),1);
79+
y2 = ylim(2) * ones(length(x1),1);
80+
81+
set(get(hXplotAxes, 'Parent'), 'CurrentAxes', hXplotAxes);
82+
83+
linesegment_plot(x1, y1, x2, y2, lineProp);
84+
linesegment_plot(x1, y1, x2, y2, lineProp);
85+
86+
figure_datestamp(mfilename, gcf);

0 commit comments

Comments
 (0)