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

Callback #1880

Merged
merged 17 commits into from
May 27, 2022
Merged

Callback #1880

merged 17 commits into from
May 27, 2022

Conversation

valentinsulzer
Copy link
Member

Description

Add callback hooks to Simulation.solve and a move some logging steps to the callback

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

@valentinsulzer valentinsulzer marked this pull request as draft December 31, 2021 01:06
@codecov
Copy link

codecov bot commented Dec 31, 2021

Codecov Report

Merging #1880 (d9667d0) into develop (3cd7388) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head d9667d0 differs from pull request most recent head 228fcb0. Consider uploading reports for the commit 228fcb0 to get more accurate results

@@             Coverage Diff             @@
##           develop    #1880      +/-   ##
===========================================
- Coverage    99.37%   99.35%   -0.02%     
===========================================
  Files          347      347              
  Lines        19136    18735     -401     
===========================================
- Hits         19016    18615     -401     
  Misses         120      120              
Impacted Files Coverage Δ
pybamm/__init__.py 100.00% <100.00%> (ø)
pybamm/callbacks.py 100.00% <100.00%> (ø)
pybamm/logger.py 100.00% <100.00%> (ø)
pybamm/simulation.py 98.56% <100.00%> (+0.06%) ⬆️
pybamm/solvers/solution.py 100.00% <100.00%> (ø)
pybamm/util.py 100.00% <100.00%> (ø)
pybamm/models/base_model.py 99.23% <0.00%> (-0.03%) ⬇️
pybamm/solvers/casadi_solver.py 98.23% <0.00%> (-0.02%) ⬇️
pybamm/parameters/parameter_values.py 99.44% <0.00%> (-0.02%) ⬇️
... and 8 more

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 0ce0a71...228fcb0. Read the comment docs.

@valentinsulzer valentinsulzer marked this pull request as ready for review March 10, 2022 20:12
@valentinsulzer
Copy link
Member Author

@martinjrobins I think this could be useful for automatically uploading simulation results from a script

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 good, thanks Tino! I guess we should extend the example notebook but we can do this in the future. Before merging, you need to update CHANGELOG.

pybamm/callbacks.py Show resolved Hide resolved
@valentinsulzer valentinsulzer merged commit 2c74a4f into develop May 27, 2022
@valentinsulzer valentinsulzer deleted the callback branch May 27, 2022 18:48
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