stan-dev / cmdstanpy

CmdStanPy is a lightweight interface to Stan for Python users which provides the necessary objects and functions to compile a Stan program and fit the model to data using CmdStan.
BSD 3-Clause "New" or "Revised" License
149 stars 67 forks source link

boolean variables are not passed correctly while reading CSV files #763

Closed aakhmetz closed 3 weeks ago

aakhmetz commented 3 weeks ago

Summary:

With the version 2.35.0, I cannot read the trace files anymore

Description:

The code

import cmdstanpy as cmdstan

paths = [str(x) for x in list(pathlib.Path(standirname).glob("trace*.csv"))]
print(paths)
fit = cmdstan.from_csv(paths)

gives the error:

ValueError: bad Stan CSV file trace-2.csv, config error, expected save_warmup = 1

I have checked the output files, and now there is the following line:

# save_warmup = false

Additional Information:

A similar issue has been reported while using arViz: https://github.com/arviz-devs/arviz/issues/2353. Actually, I also use arViz, but in the next line:

idata = az.from_cmdstanpy(posterior=fit)

Current Version:

cmdstan: 2.35.0 cmdstanpy: 1.2.3