Repository navigation
fix: run experiments on non-battery models, raise if steps are ignored - #6014
Open
brosaplanella wants to merge 3 commits into
Open
brosaplanella wants to merge 3 commits into
brosaplanella wants to merge 3 commits into
Conversation
BaseModel gains the summary_variables property, so the cycle summary of a model that is not a battery model is empty rather than an AttributeError. Simulation raises a ModelError, naming the steps, when the model does not read "Current function [A]", rather than silently ignoring the experiment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6014 +/- ##
==========================================
- Coverage 98.23% 98.22% -0.01%
==========================================
Files 350 350
Lines 36173 36181 +8
==========================================
+ Hits 35533 35540 +7
- Misses 640 641 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
| Project | PyBaMM |
| Branch | fix/experiment-non-battery-models |
| Testbed | bare-metal |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🚨 1 Alert
🐰 View full continuous benchmarking report in Bencher
Member
Author
|
The bencher regression seems to be for SPMe, only so I think it is a one-off. |
1 of 8 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BaseModel gains the summary_variables property, so the cycle summary of a model that is not a battery model is empty rather than an AttributeError. Simulation raises a ModelError, naming the steps, when the model does not read "Current function [A]", rather than silently ignoring the experiment.
Description
pybamm.Simulationaccepts an experiment with anypybamm.BaseModel, but on a model that is not a battery model:model.summary_variables, which onlyBaseBatteryModeldefined;"Current function [A]", with no error or warning.Fixes #6013
Changes
summary_variables(getter and validating setter) moves fromBaseBatteryModeltopybamm.BaseModel, where_summary_variables = []was already initialised. A model without summary variables gets an empty cycle summary.Simulationraises aModelErrorwhen the model does not read"Current function [A]"as a parameter, naming the steps. Every step sets it, directly (explicit steps) or by replacing it with the current variable (implicit steps).Steps that drive other parameters are a follow-up (#6014).
Tests
TestBaseModel.test_summary_variables_set_getTestSimulationExperiment.test_experiment_on_model_without_summary_variables: a non-battery model that reads the current runs an experiment and has an empty summary.TestSimulationExperiment.test_experiment_on_model_that_does_not_read_the_currentType of change
Bug fix
Important checks:
Please confirm the following before marking the PR as ready for review:
nox -s pre-commitnox -s testsnox -s doctests