StanJulia / CmdStan.jl

CmdStan.jl v6 provides an alternative, older Julia wrapper to Stan's `cmdstan` executable. CmdStan will be deprecated in 2022.
MIT License
30 stars 12 forks source link

Stanmodel not recognising unchanged model #111

Closed andrstef closed 3 years ago

andrstef commented 3 years ago

When constructing a Stanmodel, I always get File myfile.stan will be updated. even when the model hasn't changed. It seems, this comes from the fact that the parse_and_interpolate function always appends a newline \n at the end of the model string. Hence, in function update_model_file, if model has no trailing \n, model1 has one \n and is written out. Next time, model2 then has two trailing \n. In the end, model1 will never be equal to model2. Guess, changing line 30 in update_model_file.jl to model2 = parse_and_interpolate(strip(read(file, String))) could help.

goedman commented 3 years ago

Thank you for the issue. Will have a look.

goedman commented 3 years ago

Pushing a fix for this in CmdStan v6.1.8. Should be available in about an hour or so.

goedman commented 3 years ago

Should be available now.

andrstef commented 3 years ago

Works like a charm, thanks a lot for the fast help!