Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse string bool values in CmdStan csv header #2354

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

ahartikainen
Copy link
Contributor

@ahartikainen ahartikainen commented Jun 17, 2024

Fixes #2353

Description

Parse string bool values in CmdStan csv header.

Checklist

  • Follows official PR format
  • Includes a sample plot to visually illustrate the changes (only for plot-related functions)
  • New features are properly documented (with an example if appropriate)?
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

📚 Documentation preview 📚: https://arviz--2354.org.readthedocs.build/en/2354/

@ahartikainen ahartikainen changed the title parse str bool values Parse string bool values in CmdStan csv header Jun 17, 2024
@@ -746,6 +747,9 @@ def _process_configuration(comments):
elif match_float:
key, value = match_float.group(1), match_float.group(2)
results[key] = float(value)
elif match_str_bool:
key, value = match_str_bool.group(1), match_str_bool(2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match_str_bool(2) I believe should be matr_str_bool.group(2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, because the results dictionary values are converted to strings the value False is read incorrectly as "False" when attempting to convert to an integer on line 807 of this PR int(pconf.get("save_warmup", 0))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, let's just turn these to int

Copy link

@NicholasCowie NicholasCowie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I tried it and can now read csvs to an inference data object.
Thank you :)

@ahartikainen
Copy link
Contributor Author

I will merge this one in, given that CI errors are not related to changes done in here.

@ahartikainen ahartikainen merged commit 39eddd6 into main Jun 18, 2024
5 of 10 checks passed
@ahartikainen ahartikainen deleted the feature/str_bool_cmdstan branch June 18, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

boolean arguments in cmdstan csv comments no longer parse correctly
2 participants