Skip to content

Commit

Permalink
parse metadata, check for string true for bool values
Browse files Browse the repository at this point in the history
  • Loading branch information
mitzimorris committed Aug 2, 2024
1 parent f2e6cb5 commit 2cd6941
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/stan/io/stan_csv_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ class stan_csv_reader {
} else if (name.compare("num_warmup") == 0) {
std::stringstream(value) >> metadata.num_warmup;
} else if (name.compare("save_warmup") == 0) {
// cmdstan args can be "true" and "false", was "1", "0"
if (value.compare("true") == 0) {
value = "1";
}
std::stringstream(value) >> metadata.save_warmup;
} else if (name.compare("thin") == 0) {
std::stringstream(value) >> metadata.thin;
Expand Down Expand Up @@ -363,7 +367,8 @@ class stan_csv_reader {
}

// skip warmup draws, if any
if (data.metadata.num_warmup > 0 && !data.metadata.save_warmup) {
if (data.metadata.algorithm != "fixed_param" && data.metadata.num_warmup > 0
&& data.metadata.save_warmup) {
std::string line;
while (in.peek() != '#') {
std::getline(in, line);
Expand Down

0 comments on commit 2cd6941

Please sign in to comment.