-
Couldn't load subscription status.
- Fork 52
Library vectorization and other minor supporting changes. #143
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
Conversation
|
For some reason your change causes the state x['c'] on "test_base_models" to be returned as an ndarray after simulating (e.g., [-7.4]) even when states and inputs are all floats this is what's causing the tests to fail. I'm trying to figure out why that is before approving. Also, I'm going to add a few tests of vectorization support. |
|
Another observation. With the vectorization and python's optimizations - if the states are passed in as arrays the original states are altered as well (they aren't copied). e.g., x = {'a': array([1, 2, 3, 4])}
x_new = m.next_state(x, ...) # m adds 1 to x['a']
now both x['a'] and x_new['a'] == array([2, 3, 4,5]) This is ok, I just need to make sure it won't be confusing for users |
I understand now that this is what atleast_1d does. Question- is this strictly necessary, or can we remove it and have scalar input continue to return scalars. What do you think @MikeAndSpencer? My concern is that this is a breaking change. Anyone who build off of this package expecting the return of next_state or output to be scalar when the input is will run into issues. If I was building this from scratch I would use this and say the return must be an array, but now there are users that have build on it. I would be interested in your thoughts |
| from math import asinh, log, inf | ||
| from math import inf | ||
| from copy import deepcopy | ||
| from numpy import maximum, minimum, sign, sqrt, array, ndarray, arcsinh, log, atleast_1d |
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.
| from numpy import maximum, minimum, sign, sqrt, array, ndarray, arcsinh, log, atleast_1d | |
| from numpy import arcsinh, log, atleast_1d |
|
I merged all my suggestions into a separate PR for your review. See #148 |
|
This pull request introduces 1 alert when merging 11f5fba into ba40f0f - view on LGTM.com new alerts:
|
|
This pull request introduces 1 alert when merging e782de9 into ba40f0f - view on LGTM.com new alerts:
|
Description
battery_electrochem.py
centrifugal_pump.py
prognostics_model.py