Skip to content
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

simplify model copy #1977

Merged
merged 1 commit into from
Mar 11, 2022
Merged

simplify model copy #1977

merged 1 commit into from
Mar 11, 2022

Conversation

valentinsulzer
Copy link
Member

Description

Remove model.new_empty_copy() and simplify model.new_copy().
Not sure why I made it so complicated in the first place, but this seems to work fine and be faster

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.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Mar 10, 2022

Codecov Report

Merging #1977 (bfcb2c6) into develop (fa337e4) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1977      +/-   ##
===========================================
- Coverage    99.32%   99.32%   -0.01%     
===========================================
  Files          346      346              
  Lines        19038    19013      -25     
===========================================
- Hits         18910    18885      -25     
  Misses         128      128              
Impacted Files Coverage Δ
...m/models/full_battery_models/base_battery_model.py 99.76% <ø> (-0.01%) ⬇️
...models/full_battery_models/lead_acid/basic_full.py 100.00% <ø> (ø)
...odels/full_battery_models/lithium_ion/basic_dfn.py 100.00% <ø> (ø)
...odels/full_battery_models/lithium_ion/basic_spm.py 100.00% <ø> (ø)
...tery_models/lithium_ion/electrode_soh_half_cell.py 100.00% <ø> (ø)
pybamm/simulation.py 98.25% <ø> (ø)
pybamm/discretisations/discretisation.py 99.79% <100.00%> (ø)
...bamm/expression_tree/operations/replace_symbols.py 100.00% <100.00%> (ø)
pybamm/models/base_model.py 99.23% <100.00%> (-0.02%) ⬇️
pybamm/parameters/parameter_values.py 99.46% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 795a0c0...bfcb2c6. Read the comment docs.

Copy link
Sponsor Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks Tino!

@@ -10,31 +10,19 @@ def test_dfn_well_posed(self):
model = pybamm.lithium_ion.BasicDFN()
model.check_well_posedness()

copy = model.new_copy()
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the point of these tests, originally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just coverage

@valentinsulzer valentinsulzer merged commit 78d1feb into develop Mar 11, 2022
@valentinsulzer valentinsulzer deleted the simpler-model-copy branch March 11, 2022 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants