Please note that in commit 12af7298efd33bb830c5795210b94169f1f1eef8, I set options_.datafile='' in global_initialization.m, so it will always be a field in options_. I tried fixing this throughout the code, but could have made an error. If your code depends on options_.datafile, please make sure you are correctly treating the case when the user does not pass the datafile option, both in master and 4.3 (soon to be cherry-picked over).
Best, Houtan
On 27 Sep 2012, at 15:33, Houtan Bastani houtanb@cepremap.org wrote:
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Dynare".
The branch, master has been updated via 7c6ae272f66bebadffdf81e3761f7ecd65ba059c (commit) via 12af7298efd33bb830c5795210b94169f1f1eef8 (commit) from 894b3d69f4662a1132c0f7fb50083bf982745536 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log -----------------------------------------------------------------
commit 7c6ae272f66bebadffdf81e3761f7ecd65ba059c Author: Houtan Bastani houtan.bastani@ens.fr Date: Tue Sep 25 16:08:16 2012 +0200
ms-sbvar: remove field removal for file tags
diff --git a/matlab/ms-sbvar/initialize_ms_sbvar_options.m b/matlab/ms-sbvar/initialize_ms_sbvar_options.m index 43ea365..369cbfe 100644 --- a/matlab/ms-sbvar/initialize_ms_sbvar_options.m +++ b/matlab/ms-sbvar/initialize_ms_sbvar_options.m @@ -32,15 +32,11 @@ function options_=initialize_ms_sbvar_options(M_, options_) % MS SBVAR % all mex functions options_.ms.file_tag = M_.fname; -options_.ms.create_init = 1; options_.ms.mh_file = ''; options_.ms.free_param_file = ''; -if isfield(options_.ms,'simulation_file_tag')
- options_.ms = rmfield(options_.ms,'simulation_file_tag');
-end -if isfield(options_.ms,'output_file_tag')
- options_.ms = rmfield(options_.ms,'output_file_tag');
-end +options_.ms.output_file_tag = ''; +options_.ms.simulation_file_tag = ''; +options_.ms.create_init = 1; % prepare ms sbvar & estimation options_.ms.coefficients_prior_hyperparameters = [1.0 1.0 0.1 1.2 1.0 1.0]; options_.ms.freq = 4; diff --git a/matlab/ms-sbvar/set_file_tags.m b/matlab/ms-sbvar/set_file_tags.m index cacd91e..6945f4c 100644 --- a/matlab/ms-sbvar/set_file_tags.m +++ b/matlab/ms-sbvar/set_file_tags.m @@ -11,7 +11,7 @@ function [options_]=set_file_tags(options_) % SPECIAL REQUIREMENTS % none
-% Copyright (C) 2011 Dynare Team +% Copyright (C) 2011-2012 Dynare Team % % This file is part of Dynare. % @@ -28,7 +28,7 @@ function [options_]=set_file_tags(options_) % 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(options_.ms,'output_file_tag') +if isempty(options_.ms.output_file_tag) options_.ms.output_file_tag = options_.ms.file_tag; end end diff --git a/matlab/ms-sbvar/set_ms_simulation_file.m b/matlab/ms-sbvar/set_ms_simulation_file.m index 75e815b..b65427c 100644 --- a/matlab/ms-sbvar/set_ms_simulation_file.m +++ b/matlab/ms-sbvar/set_ms_simulation_file.m @@ -11,7 +11,7 @@ function options_=set_ms_simulation_file(options_) % SPECIAL REQUIREMENTS % none
-% Copyright (C) 2011 Dynare Team +% Copyright (C) 2011-2012 Dynare Team % % This file is part of Dynare. % @@ -28,7 +28,7 @@ function options_=set_ms_simulation_file(options_) % 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(options_.ms, 'simulation_file_tag') +if isempty(options_.ms.simulation_file_tag) options_.ms.simulation_file_tag = options_.ms.file_tag; end options_.ms.mh_file = ['simulation_' options_.ms.simulation_file_tag '.out'];
commit 12af7298efd33bb830c5795210b94169f1f1eef8 Author: Houtan Bastani houtan.bastani@ens.fr Date: Tue Sep 25 15:49:59 2012 +0200
ms-sbvar: remove unused field removal statements (and set options_.datafile='' in global_initialization)
diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m index 7be1af6..fd9e7a5 100644 --- a/matlab/dynare_identification.m +++ b/matlab/dynare_identification.m @@ -114,7 +114,7 @@ options_.Schur_vec_tol = 1.e-8; options_.nomoments=0; options_.analytic_derivation=1;
-options_ = set_default_option(options_,'datafile',[]); +options_ = set_default_option(options_,'datafile',''); options_.mode_compute = 0; options_.plot_priors = 0; [dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_, bayestopt_); diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 03f164e..219e59a 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -32,7 +32,7 @@ global oo_ M_ options_ estim_params_ bayestopt_ estimation_info ex0_ ys0_ ex_de
estim_params_ = []; bayestopt_ = [];
+options_.datafile = ''; options_.console_mode = 0;
options_.verbosity = 1; diff --git a/matlab/ms-sbvar/check_datafile_years_assigned.m b/matlab/ms-sbvar/check_datafile_years_assigned.m new file mode 100644 index 0000000..18bd51d --- /dev/null +++ b/matlab/ms-sbvar/check_datafile_years_assigned.m @@ -0,0 +1,38 @@ +function check_datafile_years_assigned(options_) +% function check_datafile_years_assigned(options_) +% check that datafile, initial_year and final_year were assigned +% +% INPUTS +% options_: (struct) options +% +% SPECIAL REQUIREMENTS +% none
+% Copyright (C) 2012 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see http://www.gnu.org/licenses/.
+if isempty(options_.ms.initial_year)
- error('Must set initial_year option');
+end
+if isempty(options_.ms.final_year)
- error('Must set final_year option');
+end
+if isempty(options_.datafile)
- error('Must set datafile option');
+end diff --git a/matlab/ms-sbvar/initialize_ms_sbvar_options.m b/matlab/ms-sbvar/initialize_ms_sbvar_options.m index 69da296..43ea365 100644 --- a/matlab/ms-sbvar/initialize_ms_sbvar_options.m +++ b/matlab/ms-sbvar/initialize_ms_sbvar_options.m @@ -33,15 +33,11 @@ function options_=initialize_ms_sbvar_options(M_, options_) % all mex functions options_.ms.file_tag = M_.fname; options_.ms.create_init = 1; -if isfield(options_.ms,'free_param_file')
- options_.ms = rmfield(options_.ms,'free_param_file');
-end +options_.ms.mh_file = ''; +options_.ms.free_param_file = ''; if isfield(options_.ms,'simulation_file_tag') options_.ms = rmfield(options_.ms,'simulation_file_tag'); end -if isfield(options_.ms,'mh_file')
- options_.ms = rmfield(options_.ms,'mh_file');
-end if isfield(options_.ms,'output_file_tag') options_.ms = rmfield(options_.ms,'output_file_tag'); end @@ -58,15 +54,8 @@ options_.ms.alpha = 1; options_.ms.beta = 1; options_.ms.gsig2_lmdm = 50^2; options_.ms.specification = 2; -if isfield(options_.ms,'initial_year')
- options_.ms = rmfield(options_.ms,'initial_year');
-end -if isfield(options_.ms,'final_year')
- options_.ms = rmfield(options_.ms,'final_year');
-end -if isfield(options_,'datafile')
- options_ = rmfield(options_,'datafile');
-end +options_.ms.initial_year = ''; +options_.ms.final_year = ''; % estimation options_.ms.convergence_starting_value = 1e-3; options_.ms.convergence_ending_value = 1e-6; diff --git a/matlab/ms-sbvar/ms_sbvar_setup.m b/matlab/ms-sbvar/ms_sbvar_setup.m index 183469a..55a2182 100644 --- a/matlab/ms-sbvar/ms_sbvar_setup.m +++ b/matlab/ms-sbvar/ms_sbvar_setup.m @@ -11,7 +11,7 @@ function ms_sbvar_setup(options_) % SPECIAL REQUIREMENTS % none
-% Copyright (C) 2003-2011 Dynare Team +% Copyright (C) 2003-2012 Dynare Team % % This file is part of Dynare. % @@ -28,18 +28,7 @@ function ms_sbvar_setup(options_) % 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(options_.ms,'initial_year')
- error('Must set initial_year option');
-end
-if ~isfield(options_.ms,'final_year')
- error('Must set final_year option');
-end
-if ~isfield(options_,'datafile')
- error('Must set datafile option');
-end
+check_datafile_years_assigned(options_) options_.data = read_variables(options_.datafile, ... options_.varobs, [], options_.xls_sheet, options_.xls_range);
diff --git a/matlab/ms-sbvar/sbvar.m b/matlab/ms-sbvar/sbvar.m index 06e0086..033051a 100644 --- a/matlab/ms-sbvar/sbvar.m +++ b/matlab/ms-sbvar/sbvar.m @@ -33,7 +33,7 @@ function sbvar(M, options) % along with Dynare. If not, see http://www.gnu.org/licenses/.
clean_sbvar_files();
+check_datafile_years_assigned(options) options.data = read_variables(options.datafile,options.varobs,[],options.xls_sheet,options.xls_range);
if options.forecast == 0 diff --git a/matlab/simul.m b/matlab/simul.m index a34c092..30abba4 100644 --- a/matlab/simul.m +++ b/matlab/simul.m @@ -65,7 +65,7 @@ if options_.periods == 0 end
if ~ options_.initval_file
- if ~isfield(options_,'datafile')
- if isempty(options_.datafile) make_ex_; make_y_; else
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 3a3451d..a33433e 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -979,12 +979,23 @@ void MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) { mod_file_struct.bvar_present = true;
- if (options_list.num_options.find("ms.create_init") == options_list.num_options.end())
- if (options_list.string_options.find("datafile") == options_list.string_options.end() ||
options_list.num_options.find("ms.initial_year") == options_list.num_options.end() ||
options_list.num_options.find("ms.final_year") == options_list.num_options.end())
{
cerr << "ERROR: If you do not pass no_create_init to ms_estimation, "
<< "you must pass the datafile, initial_year and end_year options." << endl;
exit(EXIT_FAILURE);
}
}
void MSSBVAREstimationStatement::writeOutput(ostream &output, const string &basename) const {
- output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl;
- output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl
options_list.writeOutput(output); output << "[options_, oo_] = ms_estimation(M_, options_, oo_);" << endl;<< "options_.datafile = '';" << endl;
}
Summary of changes: matlab/dynare_identification.m | 2 +- matlab/global_initialization.m | 2 +- ...file_tags.m => check_datafile_years_assigned.m} | 22 +++++++++------ matlab/ms-sbvar/initialize_ms_sbvar_options.m | 27 ++++--------------- matlab/ms-sbvar/ms_sbvar_setup.m | 15 +--------- matlab/ms-sbvar/sbvar.m | 2 +- matlab/ms-sbvar/set_file_tags.m | 4 +- matlab/ms-sbvar/set_ms_simulation_file.m | 4 +- matlab/simul.m | 2 +- preprocessor/ComputingTasks.cc | 13 +++++++++- 10 files changed, 41 insertions(+), 52 deletions(-) copy matlab/ms-sbvar/{set_file_tags.m => check_datafile_years_assigned.m} (63%)
hooks/post-receive
Dynare _______________________________________________ Commit mailing list Commit@dynare.org https://www.dynare.org/cgi-bin/mailman/listinfo/commit