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

Added pooch registries for data files #4098

Merged
merged 31 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
605d251
added pooch
santacodes May 15, 2024
a2f9e90
removed getpath()
santacodes May 15, 2024
508e419
added data_loader to notebooks and scripts
santacodes May 16, 2024
7cf3293
Merge branch 'pybamm-team:develop' into data
santacodes May 16, 2024
e4d7757
removed data files in the registry
santacodes May 16, 2024
a84ae68
Merge branch 'data' of https://github.com/santacodes/PyBaMM into data
santacodes May 16, 2024
d9ed5eb
Merge branch 'pybamm-team:develop' into data
santacodes May 18, 2024
53637f0
added docs and implemented code review suggestions
santacodes May 18, 2024
064a639
added example notebook, unit tests and edited changelog
santacodes May 18, 2024
4648e48
Merge branch 'develop' into data
santacodes May 18, 2024
2b99b92
fixed pouch cell notebook
santacodes May 18, 2024
e221bd2
Apply suggestions from code review
santacodes May 18, 2024
fd1aefe
style: pre-commit fixes
pre-commit-ci[bot] May 18, 2024
38e76ee
added more test coverage, fixed notebook and code review suggestions
santacodes May 19, 2024
3bf8a8d
added bib references
santacodes May 19, 2024
bbdc524
fixed doctest and script test errors
santacodes May 19, 2024
95c17d4
fixed codacy warnings
santacodes May 19, 2024
bf84fa8
using sockets for checking network
santacodes May 20, 2024
af0708b
Merge branch 'develop' into data
santacodes May 21, 2024
37cacd0
Merge branch 'develop' into data
brosaplanella May 21, 2024
b6bba48
code review suggestions along with notebook update
santacodes May 23, 2024
ebd59a3
Merge branch 'develop' into data
agriyakhetarpal May 24, 2024
92f988a
Merge branch 'develop' into data
arjxn-py May 25, 2024
2068032
Merge branch 'develop' into data
kratman May 27, 2024
a29c775
Apply suggestions from code review
santacodes May 27, 2024
9bd31a8
fixed RUF015
santacodes May 27, 2024
8744591
changed link referenced and fixed lychee warning
santacodes May 27, 2024
948d466
Merge branch 'develop' into data
agriyakhetarpal May 27, 2024
28562ca
Merge branch 'develop' into data
agriyakhetarpal May 28, 2024
684129e
changed the data files link under input/ to pybamm-data repo
santacodes May 29, 2024
a7a4926
Merge branch 'develop' into data
agriyakhetarpal May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.getdata(\"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
arjxn-py marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -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.getdata(\"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
}
3 changes: 2 additions & 1 deletion examples/scripts/compare_comsol/compare_comsol_DFN.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
C_rate = "1" # choose the key from the above dictionary of available results

# load the comsol results
data_loader = pybamm.DataLoader()
comsol_results_path = pybamm.get_parameters_filepath(
f"input/comsol_results/comsol_{C_rate}C.json"
f"{data_loader.getdata(f"comsol_{C_rate}C.json")}"
)

comsol_variables = json.load(open(comsol_results_path))
Expand Down
3 changes: 2 additions & 1 deletion examples/scripts/compare_comsol/discharge_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
plt.ylabel(r"$\vert V - V_{comsol} \vert$", fontsize=20)
colors = iter(plt.cycler(color="bgrcmyk"))

data_loader = pybamm.DataLoader()
for key, C_rate in C_rates.items():
current = 24 * C_rate
# load the comsol results
comsol_results_path = pybamm.get_parameters_filepath(
f"input/comsol_results/comsol_{key}C.json"
f"{data_loader.getdata(f"comsol_{key}C.json")}"
)
comsol_variables = json.load(open(comsol_results_path))
comsol_time = np.array(comsol_variables["time"])
Expand Down
3 changes: 2 additions & 1 deletion examples/scripts/drive_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@


# import drive cycle from file
data_loader = pybamm.DataLoader()
drive_cycle = pd.read_csv(
"pybamm/input/drive_cycles/US06.csv", comment="#", header=None
data_loader.getdata("US06.csv"), comment="#", header=None
).to_numpy()

# create interpolant
Expand Down
3 changes: 2 additions & 1 deletion examples/scripts/experiment_drive_cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
pybamm.set_logging_level("INFO")

# import drive cycle from file
data_loader = pybamm.DataLoader()
drive_cycle_current = pd.read_csv(
"pybamm/input/drive_cycles/US06.csv", comment="#", header=None
f"{data_loader.getdata("US06.csv")}, comment=" # ", header=None
).to_numpy()


Expand Down
3 changes: 3 additions & 0 deletions pybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
# Callbacks
from . import callbacks

# Pybamm Data manager using pooch
from .pybammdata import DataLoader

# Remove any imported modules, so we don't expose them as part of pybamm
del sys

Expand Down
Loading
Loading