Skip to content

Commit

Permalink
Added pooch registries for data files (pybamm-team#4098)
Browse files Browse the repository at this point in the history
* added pooch

* removed getpath()

* added data_loader to notebooks and scripts

* removed data files in the registry

* added docs and implemented code review suggestions

* added example notebook, unit tests and edited changelog

* fixed pouch cell notebook

* Apply suggestions from code review

Co-authored-by: Agriya Khetarpal <[email protected]>

* style: pre-commit fixes

* added more test coverage, fixed notebook and code review suggestions

* added bib references

* fixed doctest and script test errors

* fixed codacy warnings

* using sockets for checking network

* code review suggestions along with notebook update

* Apply suggestions from code review

Co-authored-by: Eric G. Kratz <[email protected]>

* fixed RUF015

* changed link referenced and fixed lychee warning

* changed the data files link under input/ to pybamm-data repo

---------

Co-authored-by: Agriya Khetarpal <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ferran Brosa Planella <[email protected]>
Co-authored-by: Arjun Verma <[email protected]>
Co-authored-by: Eric G. Kratz <[email protected]>
  • Loading branch information
6 people authored and js1tr3 committed Aug 12, 2024
1 parent 03dad20 commit 64f1bb1
Show file tree
Hide file tree
Showing 53 changed files with 907 additions and 979,843 deletions.
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# a list of links/files to be ignored by lychee link checker (see workflow file)
https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v%7BSUITESPARSE_VERSION%7D.tar.gz
https://github.com/LLNL/sundials/releases/download/v%7BSUNDIALS_VERSION%7D/sundials-%7BSUNDIALS_VERSION%7D.tar.gz
https://mac.r-project.org/openmp/openmp-%7BOPENMP_VERSION%7D-darwin20-Release.tar.gz
https://github.com/pybamm-team/pybamm-data/releases/download/%7Bself.version%7D

# Errors in docs/source/user_guide/getting_started.md
file:///home/runner/work/PyBaMM/PyBaMM/docs/source/user_guide/api_docs
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

## Breaking changes

- Removed data files under `pybamm/input` and released them in a separate repository upstream at [pybamm-data](https://github.com/pybamm-team/pybamm-data/releases/tag/v1.0.0). Note that data files under `pybamm/input/parameters` have not been removed. ([#4098](https://github.com/pybamm-team/PyBaMM/pull/4098))
- Removed `check_model` argument from `Simulation.solve`. To change the `check_model` option, use `Simulation(..., discretisation_kwargs={"check_model": False})`. ([#4020](https://github.com/pybamm-team/PyBaMM/pull/4020))
- Removed multiple Docker images. Here on, a single Docker image tagged `pybamm/pybamm:latest` will be provided with both solvers (`IDAKLU` and `JAX`) pre-installed. ([#3992](https://github.com/pybamm-team/PyBaMM/pull/3992))
- Removed support for Python 3.8 ([#3961](https://github.com/pybamm-team/PyBaMM/pull/3961))
Expand Down
1 change: 1 addition & 0 deletions docs/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ For a high-level introduction to PyBaMM, see the :ref:`user guide <user_guide>`
callbacks
citations
batch_study
pybamm_data
7 changes: 7 additions & 0 deletions docs/source/api/pybamm_data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PyBaMM Data
===========

.. autoclass:: pybamm.DataLoader
:members:

.. footbibliography::
1 change: 1 addition & 0 deletions docs/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ The notebooks are organised into subfolders, and can be viewed in the galleries
notebooks/change-settings.ipynb
notebooks/initialize-model-with-solution.ipynb
notebooks/solution-data-and-processed-variables.ipynb
notebooks/pybamm_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mWARNING: You are using pip version 21.0.1; however, version 21.1 is available.\n",
"You should consider upgrading via the '/Users/vsulzer/Documents/Energy_storage/PyBaMM/.tox/dev/bin/python -m pip install --upgrade pip' command.\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.\n"
]
}
],
"source": [
Expand Down Expand Up @@ -76,8 +81,9 @@
"outputs": [],
"source": [
"# import drive cycle from file\n",
"data_loader = pybamm.DataLoader()\n",
"drive_cycle = pd.read_csv(\n",
" \"pybamm/input/drive_cycles/US06.csv\", comment=\"#\", header=None\n",
" f\"{data_loader.get_data(\"US06.csv\")}\", comment=\"#\", header=None\n",
").to_numpy()\n",
"# create interpolant\n",
"param = model.default_parameter_values\n",
Expand Down Expand Up @@ -160,7 +166,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7ad44c260ec446e0bd04a2f7dfbf8c65",
"model_id": "cd7fa37499ed49a7a8fa691a0ad9ffa6",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -174,7 +180,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x1447078e0>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x71a9e17ab080>"
]
},
"execution_count": 6,
Expand Down Expand Up @@ -241,7 +247,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aaf63750ed354d1987703fd2fdde83af",
"model_id": "22c047080ebe4a14a664affed4e97ba1",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -255,7 +261,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x10437c370>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x71a9d02dac30>"
]
},
"execution_count": 8,
Expand Down Expand Up @@ -329,7 +335,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.12.3"
},
"toc": {
"base_numbering": 1,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions docs/source/examples/notebooks/models/compare-ecker-data.ipynb

Large diffs are not rendered by default.

64 changes: 40 additions & 24 deletions docs/source/examples/notebooks/models/pouch-cell-model.ipynb

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions docs/source/examples/notebooks/models/saving_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "dev",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -368,10 +368,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
},
"orig_nbformat": 4
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Changing the input current when solving PyBaMM models\n",
"\n",
"This notebook shows you how to change the input current when solving PyBaMM models. It also explains how to load in current data from a file, and how to add a user-defined current function. For more examples of different drive cycles see [here](https://github.com/pybamm-team/PyBaMM/tree/develop/pybamm/input/drive_cycles).\n",
"This notebook shows you how to change the input current when solving PyBaMM models. It also explains how to load in current data from a file, and how to add a user-defined current function. For more examples of different drive cycles see [here](https://github.com/pybamm-team/pybamm-data/releases/tag/v1.0.0).\n",
"\n",
"### Table of Contents\n",
"1. Constant current\n",
Expand Down Expand Up @@ -38,6 +38,13 @@
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.\n"
]
}
],
"source": [
Expand Down Expand Up @@ -76,7 +83,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aef64b871f1346a4b42c722c7eecfe38",
"model_id": "174048e3ccf74930a39a249dc0723975",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -86,6 +93,16 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x79ada1f321e0>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand All @@ -110,13 +127,13 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6447d4f706374208b5cbd283577b5da5",
"model_id": "bd1dbdfee61f4e518c3534b44e0ce879",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -126,6 +143,16 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x79ae443f29f0>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand All @@ -148,17 +175,26 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading file 'US06.csv' from 'https://github.com/pybamm-team/pybamm-data/releases/download/v1.0.0/US06.csv' to '/home/santa/.cache/pybamm'.\n"
]
}
],
"source": [
"import pandas as pd # needed to read the csv data file\n",
"\n",
"model = pybamm.lithium_ion.DFN()\n",
"\n",
"# import drive cycle from file\n",
"data_loader = pybamm.DataLoader()\n",
"drive_cycle = pd.read_csv(\n",
" \"pybamm/input/drive_cycles/US06.csv\", comment=\"#\", header=None\n",
" f\"{data_loader.get_data(\"US06.csv\")}\", comment=\"#\", header=None\n",
").to_numpy()\n",
"\n",
"# load parameter values\n",
Expand All @@ -185,13 +221,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "84f87c3d21644c20bafdac8e9b69247d",
"model_id": "513c59118a6144a8a205510aaa9e9527",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -201,6 +237,16 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x79ad7d74c620>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand Down Expand Up @@ -233,7 +279,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -258,7 +304,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -283,13 +329,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6c06d938eca0491d88cdcbb29c59cd2a",
"model_id": "40a6ad712e184ba1a161932440d7a99d",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -299,6 +345,16 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x79ad73fea6c0>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand Down Expand Up @@ -352,7 +408,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.13 ('conda_jl')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -366,7 +422,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.12.3"
},
"toc": {
"base_numbering": 1,
Expand All @@ -388,5 +444,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading

0 comments on commit 64f1bb1

Please sign in to comment.