Commit 90e2de65 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

estimation: add subsample name to index

parent c5ace037
......@@ -1742,6 +1742,14 @@ BasicPriorStatement::writeVarianceOption(ostream &output, const string &lhs_fiel
}
}
void
BasicPriorStatement::writeSubsampleName(ostream &output) const
{
OptionsList::date_options_t::const_iterator itd = options_list.date_options.find("subsample_name");
if (itd != options_list.date_options.end())
output << ":" << itd->second;
}
PriorStatement::PriorStatement(const string &name_arg,
const PriorDistributions &prior_shape_arg,
const expr_t &variance_arg,
......@@ -1765,7 +1773,9 @@ PriorStatement::writeOutput(ostream &output, const string &basename) const
string lhs_field = ".parameters.prior";
writePriorIndex(output, lhs_field);
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name << "'};" << endl
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field <<"(prior_indx).name = '" << name << "';" << endl;
writeCommonOutput(output, lhs_field);
......@@ -1798,8 +1808,10 @@ StdPriorStatement::writeOutput(ostream &output, const string &basename) const
lhs_field = "." + lhs_field + ".prior";
writePriorIndex(output, lhs_field);
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name << "'};" << endl;
output << "estimation_info" << lhs_field << "(prior_indx).name = '" << name << "';" << endl;
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field << "(prior_indx).name = '" << name << "';" << endl;
writeCommonOutput(output, lhs_field);
}
......@@ -1839,9 +1851,11 @@ CorrPriorStatement::writeOutput(ostream &output, const string &basename) const
lhs_field = "." + lhs_field + "_corr.prior";
writePriorIndex(output, lhs_field);
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name << "_" << name1 << "'};" << endl;
output << "estimation_info" << lhs_field << "(prior_indx).name1 = '" << name << "';" << endl;
output << "estimation_info" << lhs_field << "(prior_indx).name2 = '" << name1 << "';" << endl;
output << "estimation_info" << lhs_field << "_index(prior_indx) = {'" << name << "_" << name1;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field << "(prior_indx).name1 = '" << name << "';" << endl
<< "estimation_info" << lhs_field << "(prior_indx).name2 = '" << name1 << "';" << endl;
writeCommonOutput(output, lhs_field);
}
......@@ -1909,6 +1923,14 @@ BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &fi
<< " = '" << itd->second << "';" << endl;
}
void
BasicOptionsStatement::writeSubsampleName(ostream &output) const
{
OptionsList::date_options_t::const_iterator itd = options_list.date_options.find("subsample_name");
if (itd != options_list.date_options.end())
output << ":" << itd->second;
}
OptionsStatement::OptionsStatement(const string &name_arg,
const OptionsList &options_list_arg) :
BasicOptionsStatement(name_arg, options_list_arg)
......@@ -1930,7 +1952,9 @@ OptionsStatement::writeOutput(ostream &output, const string &basename) const
string lhs_field = ".parameters.options";
writeOptionsIndex(output, lhs_field);
output << "estimation_info" << lhs_field <<"_index(options_indx) = {'" << name << "'};" << endl
output << "estimation_info" << lhs_field <<"_index(options_indx) = {'" << name;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field << "(options_indx).name = '" << name << "';" << endl;
writeCommonOutput(output, lhs_field);
......@@ -1961,8 +1985,10 @@ StdOptionsStatement::writeOutput(ostream &output, const string &basename) const
lhs_field = "." + lhs_field + ".options";
writeOptionsIndex(output, lhs_field);
output << "estimation_info" << lhs_field << "_index(options_indx) = {'" << name << "'};" << endl;
output << "estimation_info" << lhs_field << "(options_indx).name = '" << name << "';" << endl;
output << "estimation_info" << lhs_field << "_index(options_indx) = {'" << name;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field << "(options_indx).name = '" << name << "';" << endl;
writeCommonOutput(output, lhs_field);
}
......@@ -1999,10 +2025,11 @@ CorrOptionsStatement::writeOutput(ostream &output, const string &basename) const
lhs_field = "." + lhs_field + "_corr.options";
writeOptionsIndex(output, lhs_field);
output << "estimation_info" << lhs_field << "_index(options_indx) = {'" << name << "_" << name1 << "'};" << endl;
lhs_field += ".";
output << "estimation_info" << lhs_field << "(options_indx).name1 = '" << name << "';" << endl;
output << "estimation_info" << lhs_field << "(options_indx).name2 = '" << name1 << "';" << endl;
output << "estimation_info" << lhs_field << "_index(options_indx) = {'" << name << "_" << name1;
writeSubsampleName(output);
output << "'};" << endl
<< "estimation_info" << lhs_field << "(options_indx).name1 = '" << name << "';" << endl
<< "estimation_info" << lhs_field << "(options_indx).name2 = '" << name1 << "';" << endl;
writeCommonOutput(output, lhs_field);
}
......@@ -600,6 +600,7 @@ protected:
void writeCommonOutput(ostream &output, const string &lhs_field) const;
void writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
void writeShape(ostream &output, const string &lhs_field) const;
void writeSubsampleName(ostream &output) const;
};
class PriorStatement : public BasicPriorStatement
......@@ -658,6 +659,7 @@ protected:
void writeOptionsIndex(ostream &output, const string &lhs_field) const;
void writeCommonOutput(ostream &output, const string &lhs_field) const;
void writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
void writeSubsampleName(ostream &output) const;
};
class OptionsStatement : public BasicOptionsStatement
......
......@@ -1334,6 +1334,7 @@ ParsingDriver::add_subsample_range(string *name1, string *name2, string *subsamp
if (tmp_map.find(*subsample_name) == tmp_map.end())
error("The subsample name " + *subsample_name + " was not previously declared in a subsample statement.");
option_date("subsample_name", *subsample_name);
option_date("date1", tmp_map[*subsample_name].first);
option_date("date2", tmp_map[*subsample_name].second);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment