-
-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 1500 print parameter info by submodel (#3846)
* Add "by_submodel" feature and modify docstring * Added line in CHANGELOG.md * Implemented error handling if `get_parameter_info` method is used directly on any submodel. * Implement changes to fix problem: Keep a track of what variables were added by get_coupled_variables in model.variables * Implement changes to fix problem: Keep a track of what variables were added by get_coupled_variables in model.variables V2 * Created object `self.variables_by_submodel` which contains submodel's name as key and its variables as value. Modified `get_parameter_info` to parse through the submodels' variables and give out `parameter_info` in `by_submodel=True` condition Modified `print_parameter_info` to print `parameter_info` of a model with an option to print submodel wise using `by_submodel=True` * Removed redundant comments. * style: pre-commit fixes * Implemented "NotImplementedError" when user tries to use "get_parameter_info" or "print_parameter_info" directly on a submodel * Implemented "NotImplementedError" when user tries to use "get_parameter_info" or "print_parameter_info" directly on a submodel V2 * Updated Docstring of "get_parameter_info" * Added Test Case for "NotImplementedError" when "get_parameter_info" or "print_parameter_info" is used on a submodel. * Renamed variables, updated test, updated docstring * Added "_find_symbols_by_submodel" method and modified "get_parameter_info" to get new parameters * Optimised "print_parameter_info" by simplification, improved readability and reduced repetition * Removed "calculate_max_lengths" and "format_table_row" from being nested inside into semi-private methods * Tests for "get_parameter_info" for both "by_submodel=False" and "by_submodel=True" * Removed duplicate test in "test_base_submodel" for when "get_parameter_info" is used directly on a submodel * added `test_get_parameter_info_submodel` test using custom model * added `test_print_parameter_info` and `test_print_parameter_info_submodel` * Modified `test_get_parameter_info_submodel` to include edge cases * formatted `test_base_model.py` * Moved change log to unreleased * Changed the formatted table's style * Added `UTF-8` encoding to the format table * Updated jupyter notebook `parameterization.ipynb` and added `UTF-8` encoding in environment variables * added utf-8 encoding in PYBAMM_ENV * Resolve minor issues --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Robert Timms <[email protected]> Co-authored-by: Arjun Verma <[email protected]> Co-authored-by: Eric G. Kratz <[email protected]> Co-authored-by: Agriya Khetarpal <[email protected]> Co-authored-by: cringeyburger <cringeyburger>
- Loading branch information
1 parent
8512040
commit fe4ac31
Showing
6 changed files
with
641 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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
297 changes: 151 additions & 146 deletions
297
docs/source/examples/notebooks/parameterization/parameterization.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Oops, something went wrong.