Fixed indentation.

parent af39a2c9
......@@ -30,78 +30,78 @@ function make_report_irfs(M, oo, ticks_every, showOutput)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if ~isfield(oo, 'irfs')
disp('make_report_irfs: oo_.irfs does not exist');
return
end
fields = fieldnames(oo.irfs);
if isempty(fields)
disp('make_report_irfs: oo_.irfs is empty');
return
end
if ~isfield(M, 'exo_names')
disp('make_report_irfs: M_.exo_names does not exist');
return
end
if ~isfield(M, 'endo_names')
disp('make_report_irfs: M_.endo_names does not exist');
return
end
if ~isfield(M, 'fname')
disp('make_report_irfs: M_.fname does not exist');
return
end
if ~isfield(oo, 'irfs')
disp('make_report_irfs: oo_.irfs does not exist');
return
end
fields = fieldnames(oo.irfs);
if isempty(fields)
disp('make_report_irfs: oo_.irfs is empty');
return
end
if ~isfield(M, 'exo_names')
disp('make_report_irfs: M_.exo_names does not exist');
return
end
if ~isfield(M, 'endo_names')
disp('make_report_irfs: M_.endo_names does not exist');
return
end
if ~isfield(M, 'fname')
disp('make_report_irfs: M_.fname does not exist');
return
end
if nargin < 3
ticks_every = 5;
else
assert(isint(ticks_every));
end
if nargin < 4
showOutput = true;
else
assert(islogical(showOutput));
end
n6 = 1;
justAddedPage = 0;
calcxticks = false;
r = report('filename', [M.fname '_canned_irf_report.tex'], 'showOutput', showOutput);
for i = 1:length(M.exo_names)
newexo = 1;
for j = 1:length(M.endo_names)
idx = ismember(fields,[strtrim(M.endo_names(j,:)) '_' ...
strtrim(M.exo_names(i,:))]);
if (mod(n6 - 1, 6) == 0 && ~justAddedPage) || ...
(newexo && any(idx))
r = r.addPage('title', {'Canned Irf Report'; ['shock ' ...
strrep(strtrim(M.exo_names(i,:)),'_','\_')]});
r = r.addSection('cols', 2);
n6 = 1;
justAddedPage = 1;
newexo = 0;
end
if any(idx)
if ~calcxticks
data = dseries(oo.irfs.(fields{idx})');
xTicks = 1:ticks_every:floor(data.nobs/ticks_every)*ticks_every+1;
xTickLabels = regexp(num2str(xTicks-1), '(?:\s)+', 'split');
calcxticks = true;
end
r = r.addGraph('data', dseries(oo.irfs.(fields{idx})'), ...
'title', strrep(M.endo_names(j,:), '_', '\_'), ...
'titleFormat', '\Huge', ...
'showGrid', false, ...
'yTickLabelZeroFill', false, ...
'yTickLabelPrecision', 1, ...
'showZeroLine', true, ...
'zeroLineColor', 'red', ...
'xTicks', xTicks, ...
'xTickLabels', xTickLabels);
n6 = n6 + 1;
justAddedPage = 0;
end
end
end
r.write();
r.compile();
if nargin < 3
ticks_every = 5;
else
assert(isint(ticks_every));
end
if nargin < 4
showOutput = true;
else
assert(islogical(showOutput));
end
n6 = 1;
justAddedPage = 0;
calcxticks = false;
r = report('filename', [M.fname '_canned_irf_report.tex'], 'showOutput', showOutput);
for i = 1:length(M.exo_names)
newexo = 1;
for j = 1:length(M.endo_names)
idx = ismember(fields,[strtrim(M.endo_names(j,:)) '_' ...
strtrim(M.exo_names(i,:))]);
if (mod(n6 - 1, 6) == 0 && ~justAddedPage) || ...
(newexo && any(idx))
r = r.addPage('title', {'Canned Irf Report'; ['shock ' ...
strrep(strtrim(M.exo_names(i,:)),'_','\_')]});
r = r.addSection('cols', 2);
n6 = 1;
justAddedPage = 1;
newexo = 0;
end
if any(idx)
if ~calcxticks
data = dseries(oo.irfs.(fields{idx})');
xTicks = 1:ticks_every:floor(data.nobs/ticks_every)*ticks_every+1;
xTickLabels = regexp(num2str(xTicks-1), '(?:\s)+', 'split');
calcxticks = true;
end
r = r.addGraph('data', dseries(oo.irfs.(fields{idx})'), ...
'title', strrep(M.endo_names(j,:), '_', '\_'), ...
'titleFormat', '\Huge', ...
'showGrid', false, ...
'yTickLabelZeroFill', false, ...
'yTickLabelPrecision', 1, ...
'showZeroLine', true, ...
'zeroLineColor', 'red', ...
'xTicks', xTicks, ...
'xTickLabels', xTickLabels);
n6 = n6 + 1;
justAddedPage = 0;
end
end
end
r.write();
r.compile();
end
......@@ -188,7 +188,7 @@ assert(iscellstr(o.xTickLabels) || (ischar(o.xTickLabels) && strcmpi(o.xTickLabe
'equivalent to the string ''ALL''']);
if ~isempty(o.xTickLabels)
assert((ischar(o.xTickLabels) && strcmpi(o.xTickLabels, 'ALL')) || ...
~isempty(o.xTicks), ['@graph.graph: if you set xTickLabels and ' ...
~isempty(o.xTicks), ['@graph.graph: if you set xTickLabels and ' ...
'it''s not equal to ''ALL'', you must set xTicks']);
end
if ~isempty(o.xTicks)
......
......@@ -29,21 +29,21 @@ if length(S) > 1
end
switch S.type
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.series{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@graph.subsasgn: field ' S.subs 'does not exist']);
end
case '{}'
assert(isint(S.subs{1}));
B{S.subs{1}} = V;
otherwise
error('@graph.subsasgn: syntax error');
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.series{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@graph.subsasgn: field ' S.subs 'does not exist']);
end
case '{}'
assert(isint(S.subs{1}));
B{S.subs{1}} = V;
otherwise
error('@graph.subsasgn: syntax error');
end
end
\ No newline at end of file
......@@ -19,31 +19,31 @@ function A = subsref(A, S)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
switch S(1).type
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@graph.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
if isempty(S(1).subs{:})
A = A.series;
else
assert(isnumeric(S(1).subs{:}));
A = A.series{S(1).subs{:}};
end
case '{}'
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@graph.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
if isempty(S(1).subs{:})
A = A.series;
else
assert(isnumeric(S(1).subs{:}));
A = A.series{S(1).subs{:}};
otherwise
error('@graph.subsref: impossible case')
end
case '{}'
A = A.series{S(1).subs{:}};
otherwise
error('@graph.subsref: impossible case')
end
S = shiftS(S,1);
......
......@@ -246,7 +246,7 @@ end
if o.showZeroline
fprintf(fid, '%%zeroline\n\\addplot[%s,line width=.5,forget plot] coordinates {(1,0)(%d,0)};\n', ...
o.zeroLineColor, dd.ndat);
o.zeroLineColor, dd.ndat);
end
if o.writeCSV
......@@ -254,61 +254,61 @@ if o.writeCSV
end
if isunix && ~ismac
for i=1:ne
isfan = ~isempty(o.series{i}.graphFanShadeColor);
if isfan
break
for i=1:ne
isfan = ~isempty(o.series{i}.graphFanShadeColor);
if isfan
break
end
end
end
if isfan
data = dseries();
for i=1:ne
tmp = o.series{i}.data;
tmp = tmp.set_names(int2str(i));
data = [data tmp];
end
if isfan
data = dseries();
for i=1:ne
tmp = o.series{i}.data;
tmp = tmp.set_names(int2str(i));
data = [data tmp];
end
if isempty(dd) || all(dd == data.dates)
ds = data;
else
ds = data(dd);
end
if isempty(dd) || all(dd == data.dates)
ds = data;
else
ds = data(dd);
end
for i=2:ne
tmp = ds{i} - ds{i-1};
idx = find(tmp.data ~= 0);
split = ds(ds.dates(idx));
end
idx = find(ds.dates == split.dates(1));
for i=2:ne
fprintf(fid, '\\addplot[fill=%s!%d, draw=none, forget plot] coordinates {',...
o.series{i}.graphFanShadeColor, o.series{i}.graphFanShadeOpacity);
for j=idx-1:ds.dates.ndat
fprintf(fid, '(%d, %f) ', j, ds{i-1}(ds.dates(j),1).data);
end
for j=ds.dates.ndat:-1:idx-1
fprintf(fid, '(%d, %f) ', j, ds{i}(ds.dates(j),1).data);
end
fprintf(fid, '} \\closedcycle;\n');
end
end
for i=2:ne
tmp = ds{i} - ds{i-1};
idx = find(tmp.data ~= 0);
split = ds(ds.dates(idx));
end
idx = find(ds.dates == split.dates(1));
for i=2:ne
fprintf(fid, '\\addplot[fill=%s!%d, draw=none, forget plot] coordinates {',...
o.series{i}.graphFanShadeColor, o.series{i}.graphFanShadeOpacity);
for j=idx-1:ds.dates.ndat
fprintf(fid, '(%d, %f) ', j, ds{i-1}(ds.dates(j),1).data);
end
for j=ds.dates.ndat:-1:idx-1
fprintf(fid, '(%d, %f) ', j, ds{i}(ds.dates(j),1).data);
end
fprintf(fid, '} \\closedcycle;\n');
end
end
end
for i=1:ne
o.series{i}.writeSeriesForGraph(fid, dd, i);
if o.writeCSV
csvseries = [csvseries ...
o.series{i}.data(dd).set_names([...
o.series{i}.data.name{:} '_' ...
o.series{i}.graphLegendName '_' ...
o.series{i}.graphLineColor '_' ...
o.series{i}.graphLineStyle '_' ...
num2str(o.series{i}.graphLineWidth) '_' ...
o.series{i}.graphMarker '_' ...
o.series{i}.graphMarkerEdgeColor '_' ...
o.series{i}.graphMarkerFaceColor '_' ...
num2str(o.series{i}.graphMarkerSize)]) ...
];
o.series{i}.data(dd).set_names([...
o.series{i}.data.name{:} '_' ...
o.series{i}.graphLegendName '_' ...
o.series{i}.graphLineColor '_' ...
o.series{i}.graphLineStyle '_' ...
num2str(o.series{i}.graphLineWidth) '_' ...
o.series{i}.graphMarker '_' ...
o.series{i}.graphMarkerEdgeColor '_' ...
o.series{i}.graphMarkerFaceColor '_' ...
num2str(o.series{i}.graphMarkerSize)]) ...
];
end
if o.showLegend
le = o.series{i}.getNameForLegend();
......
......@@ -82,8 +82,8 @@ assert(iscellstr(o.title), ...
assert(iscellstr(o.titleFormat), ...
'@page.page: titleFormat must be a cell array of strings');
assert((ischar(o.titleTruncate) && isempty(o.titleTruncate)) || ...
isint(o.titleTruncate), ...
'@page.page: titleTruncate must be empty or an integer.');
isint(o.titleTruncate), ...
'@page.page: titleTruncate must be empty or an integer.');
assert(ischar(o.pageDirName), '@page.page: pageDirName must be a string');
assert(ischar(o.latex), ...
'@page.page: latex must be a string');
......
......@@ -29,18 +29,18 @@ if length(S) > 1
end
switch S.type
case '()'
index = S.subs{:};
assert(isnumeric(index));
B{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@page.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@page.subsasgn: syntax error');
case '()'
index = S.subs{:};
assert(isnumeric(index));
B{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@page.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@page.subsasgn: syntax error');
end
end
\ No newline at end of file
......@@ -19,26 +19,26 @@ function A = subsref(A, S)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
switch S(1).type
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@page.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
A = getSections(A, S(1).subs{:});
case '{}'
error(['@page.subsref: ' S(1).type ' indexing not supported.']);
otherwise
error('@page.subsref: impossible case')
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@page.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
A = getSections(A, S(1).subs{:});
case '{}'
error(['@page.subsref: ' S(1).type ' indexing not supported.']);
otherwise
error('@page.subsref: impossible case')
end
S = shiftS(S,1);
......
......@@ -66,7 +66,7 @@ else
end
fprintf(fid,'\\multicolumn{1}{c}{%s %s}\\\\\n', o.titleFormat{i}, o.title{i});
end
nps = length(o.sections);
for i=1:nps
o.sections{i}.write(fid, pg, i);
......
......@@ -29,22 +29,22 @@ if length(S) > 1
end
switch S.type
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.elements{index} = V;
case '{}'
index = S.subs{:};
assert(isnumeric(index));
B{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@paragraph.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@paragraph.subsasgn: syntax error');
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.elements{index} = V;
case '{}'
index = S.subs{:};
assert(isnumeric(index));
B{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@paragraph.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@paragraph.subsasgn: syntax error');
end
end
\ No newline at end of file
......@@ -19,26 +19,26 @@ function A = subsref(A, S)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
switch S(1).type
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@paragraph.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
A = A.elements{S(1).subs{:}};
case '{}'
error(['@paragraph.subsref: ' S(1).type ' indexing not supported.']);
otherwise
error('@paragraph.subsref: impossible case')
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@paragraph.subsref: unknown field or method: ' S(1).subs]);
end
case '()'
A = A.elements{S(1).subs{:}};
case '{}'
error(['@paragraph.subsref: ' S(1).type ' indexing not supported.']);
otherwise
error('@paragraph.subsref: impossible case')
end
S = shiftS(S,1);
......
......@@ -67,7 +67,7 @@ if isempty(opts.compiler)
if ismac
% Add most likely places for pdflatex to exist outside of default $PATH
[status, opts.compiler] = ...
system('PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;which pdflatex');
system('PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;which pdflatex');
elseif ispc
[status, opts.compiler] = system('findtexmf --file-type=exe pdflatex');
if status == 1
......@@ -105,7 +105,7 @@ end
if status ~= 0
error(['@report.compile: There was an error in compiling ' rfn '.pdf.' ...
' ' opts.compiler ' returned the error code: ' num2str(status)]);
' ' opts.compiler ' returned the error code: ' num2str(status)]);
end
if o.showOutput || opts.showOutput
disp('Done.');
......
......@@ -29,18 +29,18 @@ if length(S) > 1
end
switch S.type
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.pages{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@report.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@report.subsasgn: syntax error');
case '()'
index = S.subs{:};
assert(isnumeric(index));
B.pages{index} = V;
case '.'
switch S.subs
case fieldnames(A)
B.(S.subs) = V;
otherwise
error(['@report.subsasgn: field ' S.subs 'does not exist']);
end
otherwise
error('@report.subsasgn: syntax error');
end
end
\ No newline at end of file
......@@ -19,26 +19,26 @@ function A = subsref(A, S)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
switch S(1).type
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@report.subsasgn: unknown field or method: ' S(1).subs]);
end
case '()'
A = A.pages{S(1).subs{:}};
case '{}'
error(['@report.subsasgn: ' S(1).type ' indexing not supported.']);
otherwise
error('@report.subsasgn: impossible case');
case '.'
switch S(1).subs
case fieldnames(A)
A = A.(S(1).subs);
case methods(A)
if areParensNext(S)
A = feval(S(1).subs, A, S(2).subs{:});
S = shiftS(S,1);
else
A = feval(S(1).subs, A);
end
otherwise
error(['@report.subsasgn: unknown field or method: ' S(1).subs]);
end
case '()'
A = A.pages{S(1).subs{:}};
case '{}'
error(['@report.subsasgn: ' S(1).type ' indexing not supported.']);