-
Notifications
You must be signed in to change notification settings - Fork 274
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
Cannot deserialize ModelResult saved before 1.1.0 #845
Comments
@jcjaskula-aws OK, yes, we should check for a valid value of |
Sounds great. Just in case 1.2.0 would have breaking changes, it might be interesting for me to commit this modification to the current main and tag it |
1.2 will not have intentional breaking changes, and I believe no significant modifications to existing tests. It will add new and enhanced features, which makes it more than only bug fixes. One thing we are not testing is reading models saved with older versions. I think we should add tests for that, exactly to avoid this sort of problem in the future. |
First Time Issue Code
Yes, I read the instructions and I am sure this is a GitHub Issue.
Description
A ModelResult loaded from a file saved with a version older than 1.1.0 will error when users try to print an HTML report. This is due to the fact that old serialized models do not contain the rsquared attribute, which is then set to
None
at loading. Printing an HTML report callsgformat
(that accepts onlyfloat
) on result.rsquared will result in a crash.More precisely, rsquared is set to
None
by default here but its type is not checked there.A Minimal, Complete, and Verifiable example
https://gist.github.com/jcjaskula-aws/81f78f5b712b5a87d574bb7dd3cc46f6
Error message:
Version information
Python: 3.10.10 (main, Feb 8 2023, 05:34:50) [Clang 14.0.0 (clang-1400.0.29.202)]
lmfit: 1.1.0, scipy: 1.9.3, numpy: 1.23.5,asteval: 0.9.29, uncertainties: 3.1.6
The text was updated successfully, but these errors were encountered: