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

Issue 871 quickplot #886

Merged
merged 26 commits into from
Mar 22, 2020
Merged

Issue 871 quickplot #886

merged 26 commits into from
Mar 22, 2020

Conversation

valentinsulzer
Copy link
Member

Description

Improvements to QuickPlot as discussed in #871
Might be good to check out the branch locally and try it to assess the changes

Fixes #871

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 13, 2020

Codecov Report

Merging #886 into develop will increase coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #886      +/-   ##
===========================================
+ Coverage    97.81%   98.00%   +0.19%     
===========================================
  Files          207      207              
  Lines        10740    10912     +172     
===========================================
+ Hits         10505    10694     +189     
+ Misses         235      218      -17     
Impacted Files Coverage Δ
pybamm/meshes/meshes.py 98.91% <100.00%> (+0.01%) ⬆️
pybamm/meshes/one_dimensional_submeshes.py 100.00% <100.00%> (ø)
...m/models/full_battery_models/base_battery_model.py 100.00% <100.00%> (ø)
pybamm/parameters/parameter_values.py 99.21% <100.00%> (ø)
pybamm/processed_variable.py 98.52% <100.00%> (+1.62%) ⬆️
pybamm/quick_plot.py 100.00% <100.00%> (+1.13%) ⬆️
pybamm/simulation.py 97.44% <100.00%> (+3.16%) ⬆️
pybamm/expression_tree/unary_operators.py 96.87% <0.00%> (+0.26%) ⬆️
pybamm/util.py 100.00% <0.00%> (+2.29%) ⬆️

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 1b0e0c5...c76a8a2. Read the comment docs.

@Scottmar93
Copy link
Contributor

Scottmar93 commented Mar 17, 2020

Looks great @tinosulzer so nice being able to sim.plot() for 2D variables now :) I'm just having a play around at the moment and will note a few comments down here:

Might be prefereable to change the axis at every time point for 2D variables. For example sim.plot(["Positive current collector potential [V]"] is just a single colour if we use the axis limits across the entire time (instead of at a specific time). Similarly for the concentrations in the particles.

Might be better to do in another issue but feel that for 3D variables we should raise a more helpful errors. E.g. for a 2+1D model doing: sim.plot(["Negative particle surface concentration [mol.m-3]"]) fails with local variable 'first_dim_pts' referenced before assignment which is a bit cryptic. This occurs for the defaults of sim.plot() so would need to be fixed when 2+1D stuff becomes more standard.

I think docs need updated on to show that the inputs to quickplot can be either a simulation or a solution object.

@TomTranter
Copy link
Contributor

Do I need to update some widgets packages - I don't see slider on dynamic plot anymore

@valentinsulzer
Copy link
Member Author

@Scottmar93 ok, I will put the changing limits as default and leave the fixed ones as an option. I'll also just raise an error for 3D variables at the start

@TomTranter possibly, I have ipywidgets==7.5.1 and matplotlib==3.1.2

@TomTranter
Copy link
Contributor

@tinosulzer updated and still no slider in windows

pybamm/simulation.py Outdated Show resolved Hide resolved
@TomTranter TomTranter self-requested a review March 18, 2020 17:13
@TomTranter
Copy link
Contributor

@Scottmar93 @rtimms can you quickly test this again and approve?

@valentinsulzer
Copy link
Member Author

I just need to figure out how to add the option for fixing axis limits or not

@valentinsulzer valentinsulzer merged commit 1f9a34f into develop Mar 22, 2020
@valentinsulzer valentinsulzer deleted the issue-871-quickplot branch March 22, 2020 19:36
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.

Improvements to QuickPlot
3 participants