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 1044 google colab #1061

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- Adapted examples to be run in Google Colab ([#1061](https://github.com/pybamm-team/PyBaMM/pull/1061))
- Added `length_scales` attribute to models ([#1058](https://github.com/pybamm-team/PyBaMM/pull/1058))
- Added averaging in secondary dimensions ([#1057](https://github.com/pybamm-team/PyBaMM/pull/1057))

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build](https://github.com/pybamm-team/PyBaMM/workflows/PyBaMM/badge.svg)](https://github.com/pybamm-team/PyBaMM/actions?query=workflow%3APyBaMM+branch%3Adevelop)
[![readthedocs](https://readthedocs.org/projects/pybamm/badge/?version=latest)](https://pybamm.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/pybamm-team/PyBaMM/branch/master/graph/badge.svg)](https://codecov.io/gh/pybamm-team/PyBaMM)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pybamm-team/PyBaMM/master?filepath=examples%2Fnotebooks)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/master/)
[![black_code_style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

PyBaMM (Python Battery Mathematical Modelling) solves physics-based electrochemical DAE models by using state-of-the-art automatic differentiation and numerical solvers. The Doyle-Fuller-Newman model can be solved in under 0.1 seconds, while the reduced-order Single Particle Model and Single Particle Model with electrolyte can be solved in just a few milliseconds. Additional physics can easily be included such as thermal effects, fast particle diffusion, 3D effects, and more. All models are implemented in a flexible manner, and a wide range of models and parameter sets (NCA, NMC, LiCoO2, ...) are available. There is also functionality to simulate any set of experimental instructions, such as CCCV or GITT, or specify drive cycles.
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/Creating Models/1-an-ode-model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
Expand Down Expand Up @@ -278,7 +279,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/Creating Models/2-a-pde-model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
Expand Down Expand Up @@ -308,7 +309,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -330,7 +331,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -390,7 +391,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -669,7 +670,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm"
]
},
Expand Down Expand Up @@ -139,7 +140,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm"
]
},
Expand Down Expand Up @@ -431,7 +432,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
}
],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"model = pybamm.lithium_ion.SPMe()\n",
"sim = pybamm.Simulation(model)\n",
Expand Down Expand Up @@ -851,7 +852,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm"
]
},
Expand Down Expand Up @@ -136,7 +137,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ For new users we recommend the [Getting Started](./Getting%20Started/) notebooks

# Examples

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pybamm-team/PyBaMM/master)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/master/)

This page contains a number of examples showing how to use PyBaMM.

Expand Down
15 changes: 12 additions & 3 deletions examples/notebooks/change-input-current.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -329,7 +338,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/change-settings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -518,7 +519,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/compare-comsol-discharge-curve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -207,7 +208,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/compare-ecker-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import os\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -237,7 +238,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/expression_tree/broadcasts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np"
]
Expand Down Expand Up @@ -260,7 +261,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/expression_tree/expression-tree.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"\n",
Expand Down Expand Up @@ -220,7 +221,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/DFN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -278,7 +279,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/SPM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -1092,7 +1093,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/SPMe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -269,7 +270,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/compare-lithium-ion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import os\n",
"os.chdir(pybamm.__path__[0]+'/..')\n",
Expand Down Expand Up @@ -442,7 +443,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/lead-acid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import numpy as np\n",
"import os\n",
Expand Down Expand Up @@ -424,7 +425,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion examples/notebooks/models/pouch-cell-model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install pybamm -q # install PyBaMM if it is not installed\n",
"import pybamm\n",
"import sys\n",
"import pickle\n",
Expand Down Expand Up @@ -808,7 +809,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Loading