Skip to content

Update quickplot to catch empty lists - #3359

Merged
brosaplanella merged 5 commits into
pybamm-team:developfrom
kratman:feat/fixQuickPlot
Sep 21, 2023
Merged

brosaplanella merged 5 commits into
pybamm-team:developfrom
kratman:feat/fixQuickPlot

Conversation

@kratman

@kratman kratman commented Sep 20, 2023

Copy link
Copy Markdown
Contributor

Description

I added some error handling for QuickPlot when an empty list is passed as the first argument.

Changes:

  • Added a check that raises an error when an empty list is passed: QuickPlot([])
  • Added a new test to confirm the check functions correctly.
  • Minor refactoring of QuickPlot to create new functions for the input pre-processing.

Fixes #3172

Type of change

Minor bug fix for catching empty input lists.

  • 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: $ 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)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ 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:

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

@codecov

codecov Bot commented Sep 20, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02% ⚠️

Comparison is base (2eb5c59) 99.57% compared to head (243de25) 99.56%.
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3359      +/-   ##
===========================================
- Coverage    99.57%   99.56%   -0.02%     
===========================================
  Files          253      253              
  Lines        19571    19555      -16     
===========================================
- Hits         19488    19470      -18     
- Misses          83       85       +2     
Files Changed Coverage Δ
pybamm/plotting/quick_plot.py 99.72% <100.00%> (+<0.01%) ⬆️
pybamm/simulation.py 99.54% <100.00%> (-0.46%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brosaplanella brosaplanella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just a couple of things before approving. Can you address the small comment on the test and add an entry to the CHANGELOG?

Comment thread tests/unit/test_plotting/test_quick_plot.py Outdated

@brosaplanella brosaplanella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you commit the suggested change? Happy to merge afterwards

Comment thread CHANGELOG.md Outdated
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
@brosaplanella

Copy link
Copy Markdown
Member

@all-contributors please add @kratman for tests

@allcontributors

Copy link
Copy Markdown
Contributor

@brosaplanella

I've put up a pull request to add @kratman! 🎉

@brosaplanella
brosaplanella merged commit 080d91e into pybamm-team:develop Sep 21, 2023
@kratman
kratman deleted the feat/fixQuickPlot branch September 22, 2023 16:02
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.

Raise error if empty list passed to QuickPlot

2 participants