Skip to content

Commit

Permalink
Merge pull request #886 from pybamm-team/issue-871-quickplot
Browse files Browse the repository at this point in the history
Issue 871 quickplot
  • Loading branch information
valentinsulzer authored Mar 22, 2020
2 parents 1b0e0c5 + c76a8a2 commit 1f9a34f
Show file tree
Hide file tree
Showing 34 changed files with 1,401 additions and 515 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exclude=
share,
pyvenv.cfg,
third-party,
sundials-5.0.0,
ignore=
# False positive for white space before ':' on list slice
# black should format these correctly
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

## Features

<<<<<<< HEAD
- Added functionality to broadcast to edges ([#891](https://github.com/pybamm-team/PyBaMM/pull/891))
- Reformatted and cleaned up `QuickPlot` ([#886](https://github.com/pybamm-team/PyBaMM/pull/886))
- Added thermal effects to lead-acid models ([#885](https://github.com/pybamm-team/PyBaMM/pull/885))
- Add new symbols `VariableDot`, representing the derivative of a variable wrt time,
and `StateVectorDot`, representing the derivative of a state vector wrt time
([#858](https://github.com/pybamm-team/PyBaMM/issues/858))
=======
- Add new symbols `VariableDot`, representing the derivative of a variable wrt time,
and `StateVectorDot`, representing the derivative of a state vector wrt time
([#858](https://github.com/pybamm-team/PyBaMM/issues/858))
- Added functionality to broadcast to edges
([#891](https://github.com/pybamm-team/PyBaMM/pull/891))
>>>>>>> 1b0e0c59154736ed48c92f45e042a9f006f33162
- Added additional notebooks showing how to create and compare models ([#877](https://github.com/pybamm-team/PyBaMM/pull/877))
- Added `Minimum`, `Maximum` and `Sign` operators
([#876](https://github.com/pybamm-team/PyBaMM/pull/876))
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ Contents
source/spatial_methods/index
source/solvers/index
source/experiments/index
source/simulation
source/quick_plot
source/processed_variable
source/util
source/simulation
source/citations
source/parameters_cli

Expand Down
5 changes: 5 additions & 0 deletions docs/source/quick_plot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Quick Plot
==========

.. autoclass:: pybamm.QuickPlot
:members:
32 changes: 12 additions & 20 deletions examples/notebooks/change-input-current.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "528740d94922483b86f14724fcfa32b8",
"model_id": "8247adc1a3fd42dba31101bc6b501ed9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.0006659775771737802, step=0.005), Output()"
"interactive(children=(FloatSlider(value=0.0, description='t', max=15.050167224080266, step=0.15050167224080266"
]
},
"metadata": {},
Expand All @@ -98,9 +98,7 @@
"\n",
"# plot\n",
"quick_plot = pybamm.QuickPlot(solution)\n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(quick_plot.plot, t=widgets.FloatSlider(min=0,max=solution.t[-1],step=0.005,value=0));"
"quick_plot.dynamic_plot();"
]
},
{
Expand All @@ -118,12 +116,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2811c58f82064ae6b2e558d33c5551fd",
"model_id": "511a6922f3f34350a543367723f09572",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.022125255063884477, step=0.005), Output())…"
"interactive(children=(FloatSlider(value=0.0, description='t', max=500.0, step=5.0), Output()), _dom_classes=('"
]
},
"metadata": {},
Expand All @@ -136,9 +134,7 @@
"\n",
"# plot\n",
"quick_plot = pybamm.QuickPlot(solution)\n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(quick_plot.plot, t=widgets.FloatSlider(min=0,max=solution.t[-1],step=0.005,value=0));"
"quick_plot.dynamic_plot();"
]
},
{
Expand All @@ -158,12 +154,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8bad57c00aec41bd85c17bec2981a8da",
"model_id": "def542dad39b4ddebcd9a555cf684580",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.026550306076661374, step=0.001), Output())…"
"interactive(children=(FloatSlider(value=0.0, description='t', max=600.0, step=6.0), Output()), _dom_classes=('"
]
},
"metadata": {},
Expand Down Expand Up @@ -195,9 +191,7 @@
"\n",
"# plot\n",
"quick_plot = pybamm.QuickPlot(solution)\n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(quick_plot.plot, t=widgets.FloatSlider(min=0,max=solution.t[-1],step=0.001,value=0));"
"quick_plot.dynamic_plot();"
]
},
{
Expand Down Expand Up @@ -279,12 +273,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "47c47acd733b46428148e9dc7cdf373e",
"model_id": "7f4df64df94d410fb9aff92003538b14",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.0013275153038330688, step=6.63757651916534"
"interactive(children=(FloatSlider(value=0.0, description='t', max=30.0, step=0.3), Output()), _dom_classes=('w"
]
},
"metadata": {},
Expand All @@ -309,9 +303,7 @@
"# plot current and voltage\n",
"output_variables = [\"Current [A]\", \"Terminal voltage [V]\"]\n",
"quick_plot = pybamm.QuickPlot(solution, output_variables, label)\n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(quick_plot.plot, t=widgets.FloatSlider(min=0,max=solution.t[-1],step=solution.t[-1]/20,value=0));"
"quick_plot.dynamic_plot();"
]
},
{
Expand Down
12 changes: 5 additions & 7 deletions examples/notebooks/models/DFN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To get a quick overview of the model outputs we can use the QuickPlot class, which plots a common set of useful outputs. The method Quickplot.plot(t) is simply a function which either can be used statically to create a plot for a particular time, or interactively with a slider widget."
"To get a quick overview of the model outputs we can use the QuickPlot class, which plots a common set of useful outputs. The method `Quickplot.dynamic_plot` makes a slider widget."
]
},
{
Expand All @@ -195,12 +195,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "db794fc42b6743c4a2baad036cc9b5bc",
"model_id": "29f22a3ab3bd4ce8825acdd6fb655f36",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.15930183645996823, step=0.05), Output()), "
"interactive(children=(FloatSlider(value=0.0, description='t', max=3599.9999999999995, step=35.99999999999999),"
]
},
"metadata": {},
Expand All @@ -209,9 +209,7 @@
],
"source": [
"quick_plot = pybamm.QuickPlot(solution)\n",
"\n",
"import ipywidgets as widgets\n",
"widgets.interact(quick_plot.plot, t=widgets.FloatSlider(min=0,max=solution.t[-1],step=0.05,value=0));"
"quick_plot.dynamic_plot();"
]
},
{
Expand Down Expand Up @@ -273,7 +271,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 1f9a34f

Please sign in to comment.