From 443119a8e1d2364fa2e5c0caab8a04c1370daf21 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Tue, 31 Dec 2013 12:54:49 +0100 Subject: [PATCH] reporting: remove annualAverages option(cherry picked from commit 809c3aca11165841bdcf47150fa0ca1631f90f51) --- doc/dynare.texi | 7 +---- matlab/reports/@report_series/write.m | 29 ++------------------- matlab/reports/@report_table/report_table.m | 3 --- matlab/reports/@report_table/write.m | 17 ++---------- 4 files changed, 5 insertions(+), 51 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index eb8f5a0d5..f7aff57a5 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -10485,16 +10485,11 @@ Display a solid black line at @math{y = 0}. Default: @code{false} @end table @end defmethod -@defmethod Report addTable annualAverages, data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines +@defmethod Report addTable data, showHlines, precision, range, seriesToUse, title, titleSize, vlineAfter, vlineAfterEndOfPeriod, showVlines Adds a @code{Table} to a @code{Section}. @optionshead @table @code -@item annualAverages, @code{bool} -Compute the average over every year in the table and display it in a -column to the right of the data (one column for every year). Only -works for quarterly data. Default: @code{false} - @item data, @code{dseries} @xref{data}. diff --git a/matlab/reports/@report_series/write.m b/matlab/reports/@report_series/write.m index 6377b55d7..f2a5d3c0e 100644 --- a/matlab/reports/@report_series/write.m +++ b/matlab/reports/@report_series/write.m @@ -1,5 +1,5 @@ -function o = write(o, fid, dates, precision, yrsForAvgs) -%function o = write(o, fid, dates, precision, yrsForAvgs) +function o = write(o, fid, dates, precision) +%function o = write(o, fid, dates, precision) % Write Table Row % % INPUTS @@ -7,7 +7,6 @@ function o = write(o, fid, dates, precision, yrsForAvgs) % fid [int] file id % dates [dates] dates for report_series slice % precision [float] precision with which to print the data -% yrsForAvgs [bool] the years for which to compute averages % % % OUTPUTS @@ -62,9 +61,6 @@ if ~isempty(o.tableRowColor) end if ~isempty(o.tableSubSectionHeader) fprintf(fid, '%s', o.tableSubSectionHeader); - for i=1:size(dates)+length(yrsForAvgs) - fprintf(fid, '&'); - end fprintf(fid, '\\\\%%\n'); return; end @@ -94,26 +90,5 @@ for i=1:size(data,1) fprintf(fid, ']'); end end - -% Calculate and display annual averages -for i=1:length(yrsForAvgs) - slice = o.data(dates([num2str(yrsForAvgs(i)) 'q1']):dates([num2str(yrsForAvgs(i)) 'q4'])); - avg = sum(slice.data)/size(slice); - fprintf(fid, '&'); - if o.tableShowMarkers - if avg < -o.tableMarkerLimit - fprintf(fid, '\\color{%s}', o.tableNegColor); - elseif avg > o.tableMarkerLimit - fprintf(fid, '\\color{%s}', o.tablePosColor); - end - fprintf(fid, '['); - end - - fprintf(fid, dataString, round(avg*precision)/precision); - - if o.tableShowMarkers - fprintf(fid, ']'); - end -end fprintf(fid, '\\\\%%\n'); end diff --git a/matlab/reports/@report_table/report_table.m b/matlab/reports/@report_table/report_table.m index f336212d2..e84803dce 100644 --- a/matlab/reports/@report_table/report_table.m +++ b/matlab/reports/@report_table/report_table.m @@ -41,8 +41,6 @@ o.showVlines = false; o.vlineAfter = ''; o.vlineAfterEndOfPeriod = false; -o.annualAverages = false; - o.data = ''; o.seriesToUse = ''; o.range = {}; @@ -75,7 +73,6 @@ end % Check options provided by user assert(ischar(o.title), '@report_table.report_table: title must be a string'); -assert(islogical(o.annualAverages), '@report_table.report_table: annualAverages must be true or false'); assert(islogical(o.showHlines), '@report_table.report_table: showHlines must be true or false'); assert(islogical(o.showVlines), '@report_table.report_table: showVlines must be true or false'); assert(isint(o.precision), '@report_table.report_table: precision must be an int'); diff --git a/matlab/reports/@report_table/write.m b/matlab/reports/@report_table/write.m index 32d1a8c1e..0325a7455 100644 --- a/matlab/reports/@report_table/write.m +++ b/matlab/reports/@report_table/write.m @@ -74,17 +74,7 @@ for i=1:ndates end datedata = dates.time; years = unique(datedata(:, 1)); -if o.annualAverages - yrsForAvgs = years; -else - yrsForAvgs = []; -end -for i=1:length(yrsForAvgs) - fprintf(fid, 'r'); - if o.showVlines - fprintf(fid, '|'); - end -end + fprintf(fid, '@{}}%%\n'); if ~isempty(o.title) fprintf(fid, '\\multicolumn{%d}{c}{\\%s %s}\\\\\n', ... @@ -131,9 +121,6 @@ switch dates.freq otherwise error('@report_table.write: invalid dseries frequency'); end -for i=1:length(yrsForAvgs) - fprintf(fid, ' & %d', years(i)); -end fprintf(fid, '\\\\[-2pt]%%\n'); fprintf(fid, '\\hline%%\n'); fprintf(fid, '%%\n'); @@ -141,7 +128,7 @@ fprintf(fid, '%%\n'); % Write Report_Table Data ne = o.seriesElements.numSeriesElements(); for i=1:ne - o.seriesElements(i).write(fid, dates, o.precision, yrsForAvgs); + o.seriesElements(i).write(fid, dates, o.precision); if o.showHlines fprintf(fid, '\\hline\n'); end -- GitLab