-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Allow input parameters in ESOH model #3921
Allow input parameters in ESOH model #3921
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3921 +/- ##
===========================================
- Coverage 99.60% 99.60% -0.01%
===========================================
Files 259 259
Lines 21332 21290 -42
===========================================
- Hits 21248 21206 -42
Misses 84 84 ☔ View full report in Codecov by Sentry. |
pybamm/models/full_battery_models/lithium_ion/electrode_soh_half_cell.py
Outdated
Show resolved
Hide resolved
tests/unit/test_models/test_full_battery_models/test_lithium_ion/test_electrode_soh.py
Outdated
Show resolved
Hide resolved
pybamm/models/full_battery_models/lithium_ion/electrode_soh_half_cell.py
Outdated
Show resolved
Hide resolved
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.
Thanks, looks good to me
Can you fix coverage? |
will do it tomorrow. I'm guessing that line cannot be accessed or should not be accessed. |
Breaking things into new functions tends to make it easy to cover those safety lines. Generally if you write it in a "functional" style (i.e. constant arguments into the function, returns the values, no state changes to member variables) then it gets trivial to test. |
Taking a look through the code, this case ( This function is only 13 lines of code, do you really think it should be broken out into multiple separate functions? Or am I misunderstanding something |
I did not look at the whole function, just recommending methods for testing error handling. I will say that in general it is best to end an if-elif chain with an else. It lets future developers know that no cases were forgotten and that the intention was to end the chain that way. So my preference would be leaving the else but adding a test for it |
I agree, hence why I added the |
@abillscmu Cleanup as we go is usually a good thing, but if you don't want to do it here then can you make a ticket for it with a couple examples of places it appears? You can assign it to me and I will refactor it later |
There are some other changes that would be good to make to the eSOH stuff (see #3930), so happy to make that ticket into a place to track all the refactoring needed. |
I am happy to merge this PR once @kratman approves it |
@tinosulzer All I was waiting for was a ticket for the places where @abillscmu found the missing else statements. Since he already knew where they were |
They really aren't hard to find, all of them I know of are in I guess my comment
caused some confusion -- "throughout pybamm" lol is a bit of a stretch. In any case, I added specific exceptions to a few of the higher-level occurrences of this chain that should catch all of them. Any more will likely require a more in-depth refactor, and anyone completing the refactor should have no issues finding the chains (assuming they are still there after the refactor). |
Yeah I just wanted the ticket as more of a reminder to myself to go back and check for them |
Looks like test failures are related to #3530 being merged in so you'll need to merge develop and fix conflicts |
Description
Allows input parameters in the ESOH model. This allows for use of the
initial_soc
keyword insim.solve
for variables such asPositive electrode active material volume fraction
, which previously errored.Fixes #2981
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: