-
Notifications
You must be signed in to change notification settings - Fork 49
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
Cache bug ylimit (fix: deepcopy instead of shallow copy) #678
Conversation
…DougBurke/sherpa into DougBurke-allow-slow-tests-to-be-optional
Not sure why there are five file changes in this PR. The only expected changes should be in file: sherpa/models/model.py |
perhaps the following code
in the file models/model.py should be changed to:
also |
I would like the commit history to be cleared up before I review this. I think either rebasing onto a clean, up to date master branch or cherry-picking the commit onto a clean, up to date, master branch should work. |
I personally don't have a good feel for how the cache code and the setup/teardown methods are meant to interact. Previously I think the cache was only used for models with no free parameters, and then only within the context of a "setup/teardown" call - e.g. as done by a fit call. This is presumably why there is a unilateral "turn off cacheing" in the teardown method, in case it had been turned on by the setup method. We've now changed things so that cacheing is expected to be on, so turning it off in teardown isn't very useful. However, I am not convinced that always turning it on is a great idea either. My current feeling would be that the teardown method shouldn't change the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the history be cleaned up before this gets merged?
@dtnguyen2 - Can you please rebase this so that it only touches the expected file (models.py) instead of 5 files? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code and test look fine. I thought you were going to clean up the history before I was to sign off?
It was easier to clean up by issuing a new PR #705, so will close this PR |
Release Note
The function
cache_model
makes shallow copy of the cached function values, this PR added a couple of ```.copy()`` to make sure deep copies are made instead. This PR is a fix to issue #673Note
In re-reading the code I also noticed that the setting of the
_use_caching
member of the classArithmeticModel
was not set consistently in the member function__set_state__