Skip to content

Serialize inf/nan to json#488

Merged
WardBrian merged 3 commits intodevelopfrom
nan-inf
Nov 1, 2021
Merged

Serialize inf/nan to json#488
WardBrian merged 3 commits intodevelopfrom
nan-inf

Conversation

@WardBrian
Copy link
Copy Markdown
Member

Submission Checklist

  • Run unit tests
  • Declare copyright holder and open-source license: see below

Summary

This changes write_stan_json to turn Nan into "NaN", inf to "+inf", and -inf to "-inf" as CmdStan expects. It only calls this as necessary, so it shouldn't be too much less efficient than the prior check which threw an error in these cases.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

@WardBrian WardBrian requested a review from mitzimorris November 1, 2021 16:49
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 1, 2021

Codecov Report

Merging #488 (86e7a81) into develop (725ad89) will decrease coverage by 0.37%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #488      +/-   ##
===========================================
- Coverage    77.95%   77.58%   -0.38%     
===========================================
  Files           30       20      -10     
  Lines         8991     6018    -2973     
===========================================
- Hits          7009     4669    -2340     
+ Misses        1982     1349     -633     
Impacted Files Coverage Δ
a/cmdstanpy/cmdstanpy/cmdstanpy/install_cmdstan.py
...tanpy/cmdstanpy/cmdstanpy/install_cxx_toolchain.py
a/cmdstanpy/cmdstanpy/cmdstanpy/_version.py
a/cmdstanpy/cmdstanpy/cmdstanpy/compiler_opts.py
a/cmdstanpy/cmdstanpy/cmdstanpy/progress.py
a/cmdstanpy/cmdstanpy/cmdstanpy/__init__.py
a/cmdstanpy/cmdstanpy/cmdstanpy/stanfit.py
a/cmdstanpy/cmdstanpy/cmdstanpy/cmdstan_args.py
a/cmdstanpy/cmdstanpy/cmdstanpy/utils.py
a/cmdstanpy/cmdstanpy/cmdstanpy/model.py
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 725ad89...86e7a81. Read the comment docs.

Comment thread cmdstanpy/utils.py
Copy link
Copy Markdown
Member

@mitzimorris mitzimorris left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Copy Markdown
Contributor

@ahartikainen ahartikainen left a comment

Choose a reason for hiding this comment

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

LGTM

@WardBrian WardBrian merged commit 3d207c8 into develop Nov 1, 2021
@WardBrian WardBrian deleted the nan-inf branch November 1, 2021 20:17
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.

4 participants