Skip to content

Commit 817ac83

Browse files
authored
Merge pull request #4781 from pybamm-team/release/v25.1.1
Release v25.1.1
2 parents 590fdfe + 2e99a0e commit 817ac83

26 files changed

+146
-114
lines changed

.clang-format

-3
This file was deleted.

.github/codecov.yml

Whitespace-only changes.

.github/workflows/docker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
password: ${{ secrets.DOCKERHUB_TOKEN }}
3131

3232
- name: Build and push Docker image to Docker Hub
33-
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
33+
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
3434
with:
3535
context: .
3636
file: scripts/Dockerfile

.github/workflows/run_periodic_tests.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
if: matrix.os == 'ubuntu-latest'
3737
run: |
3838
sudo apt-get update
39-
sudo dot -c
39+
sudo apt-get install gfortran gcc graphviz pandoc
4040
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
4141
4242
- name: Install macOS system dependencies
@@ -100,6 +100,7 @@ jobs:
100100
- name: Install Linux system dependencies
101101
run: |
102102
sudo apt-get update
103+
sudo apt-get install graphviz pandoc
103104
sudo apt-get install texlive-latex-extra dvipng
104105
105106
- name: Set up Python
@@ -132,6 +133,7 @@ jobs:
132133
- name: Install Linux system dependencies
133134
run: |
134135
sudo apt-get update
136+
sudo apt-get install gfortran gcc graphviz pandoc
135137
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
136138
137139
- name: Set up Python 3.12
@@ -161,6 +163,7 @@ jobs:
161163
- name: Install Linux system dependencies
162164
run: |
163165
sudo apt-get update
166+
sudo apt-get install gfortran gcc graphviz
164167
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
165168
166169
- name: Set up Python 3.12

.github/workflows/update_license.yml

-39
This file was deleted.

.github/workflows/validation_benchmarks.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: Alert validation repository
22
on:
3+
workflow_dispatch:
34
release:
45
types:
56
- published
6-
push:
7-
branches:
8-
- develop
97

108
jobs:
119
build:

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: "v0.9.1"
7+
rev: "v0.9.2"
88
hooks:
99
- id: ruff
1010
args: [--fix, --show-fixes]

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)
22

3+
# [v25.1.1](https://github.com/pybamm-team/PyBaMM/tree/v25.1.1) - 2025-01-20
4+
5+
## Features
6+
7+
- Added Operators to current and voltage termination events. ([#4770](https://github.com/pybamm-team/PyBaMM/pull/4770))
8+
9+
## Bug fixes
10+
11+
- Fixed a bug which caused the wc-reaction limited SEI model to give
12+
incorrect results ([#4774](https://github.com/pybamm-team/PyBaMM/pull/4774))
13+
314
# [v25.1.0](https://github.com/pybamm-team/PyBaMM/tree/v25.1.0) - 2025-01-14
415

516
## Features

CITATION.cff

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ keywords:
2424
- "expression tree"
2525
- "python"
2626
- "symbolic differentiation"
27-
version: "25.1.0"
27+
version: "25.1.1"
2828
repository-code: "https://github.com/pybamm-team/PyBaMM"
2929
title: "Python Battery Mathematical Modelling (PyBaMM)"

CONTRIBUTING.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -422,18 +422,13 @@ wherever code is called that uses that citation (for example, in functions or in
422422

423423
### Installation
424424

425-
Installation of PyBaMM and its dependencies is handled via [pip](https://pip.pypa.io/en/stable/) and [setuptools](http://setuptools.readthedocs.io/). It uses `CMake` to compile C++ extensions using [`pybind11`](https://pybind11.readthedocs.io/en/stable/) and [`casadi`](https://web.casadi.org/). The installation process is described in detail in the [source installation](https://docs.pybamm.org/en/latest/source/user_guide/installation/install-from-source.html) page and is configured through the `CMakeLists.txt` file.
425+
Installation of PyBaMM and its dependencies is handled via [pip](https://pip.pypa.io/en/stable/)
426426

427427
Configuration files:
428-
429428
```
430-
setup.py
431429
pyproject.toml
432-
MANIFEST.in
433430
```
434431

435-
Note: `MANIFEST.in` is used to include and exclude non-Python files and auxiliary package data for PyBaMM when distributing it. If a file is not included in `MANIFEST.in`, it will not be included in the source distribution (SDist) and subsequently not be included in the binary distribution (wheel).
436-
437432
### Continuous Integration using GitHub Actions
438433

439434
Each change pushed to the PyBaMM GitHub repository will trigger the test and benchmark suites to be run, using [GitHub Actions](https://github.com/features/actions).

conftest.py

-7
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@ def pytest_addoption(parser):
1919
default=False,
2020
help="run integration tests",
2121
)
22-
parser.addoption(
23-
"--cibw",
24-
action="store_true",
25-
default=False,
26-
help="test build wheels",
27-
)
2822

2923

3024
def pytest_configure(config):
3125
config.addinivalue_line("markers", "scripts: mark test as an example script")
3226
config.addinivalue_line("markers", "unit: mark test as a unit test")
3327
config.addinivalue_line("markers", "integration: mark test as an integration test")
34-
config.addinivalue_line("markers", "cibw: mark test as build wheel test")
3528

3629

3730
def pytest_collection_modifyitems(items):

noxfile.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ def run_integration(session):
6464
@nox.session(name="doctests")
6565
def run_doctests(session):
6666
"""Run the doctests and generate the output(s) in the docs/build/ directory."""
67-
# TODO: Temporary fix for Python 3.12 CI.
68-
# See: https://bitbucket.org/pybtex-devs/pybtex/issues/169/
67+
# Fix for Python 3.12 CI. This can be removed after pybtex is replaced.
6968
session.install("setuptools", silent=False)
7069
session.install("-e", ".[all,dev,docs]", silent=False)
7170
session.run(
@@ -102,9 +101,7 @@ def run_examples(session):
102101
def run_scripts(session):
103102
"""Run the scripts tests for Python scripts."""
104103
set_environment_variables(PYBAMM_ENV, session=session)
105-
# Temporary fix for Python 3.12 CI. TODO: remove after
106-
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
107-
# is fixed
104+
# Fix for Python 3.12 CI. This can be removed after pybtex is replaced.
108105
session.install("setuptools", silent=False)
109106
session.install("-e", ".[all,dev,jax]", silent=False)
110107
session.run("python", "-m", "pytest", "-m", "scripts")
@@ -119,9 +116,7 @@ def set_dev(session):
119116
python = os.fsdecode(VENV_DIR.joinpath("bin/python"))
120117
components = ["all", "dev", "jax"]
121118
args = []
122-
# Temporary fix for Python 3.12 CI. TODO: remove after
123-
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
124-
# is fixed
119+
# Fix for Python 3.12 CI. This can be removed after pybtex is replaced.
125120
session.run(python, "-m", "pip", "install", "setuptools", external=True)
126121
session.run(
127122
python,
@@ -153,8 +148,7 @@ def run_tests(session):
153148
def build_docs(session):
154149
"""Build the documentation and load it in a browser tab, rebuilding on changes."""
155150
envbindir = session.bin
156-
# TODO: Temporary fix for Python 3.12 CI.
157-
# See: https://bitbucket.org/pybtex-devs/pybtex/issues/169/
151+
# Fix for Python 3.12 CI. This can be removed after pybtex is replaced.
158152
session.install("setuptools", silent=False)
159153
session.install("-e", ".[all,docs]", silent=False)
160154
session.chdir("docs")

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "pybamm"
9-
version = "25.1.0"
9+
version = "25.1.1"
1010
license = { file = "LICENSE.txt" }
1111
description = "Python Battery Mathematical Modelling"
1212
authors = [{name = "The PyBaMM Team", email = "[email protected]"}]
@@ -227,7 +227,6 @@ required_plugins = [
227227
"pytest-mock",
228228
"pytest-subtests",
229229
]
230-
norecursedirs = 'pybind11*'
231230
addopts = [
232231
"-nauto",
233232
"-vra",
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .steps import *
22
from .base_step import BaseStep, BaseStepExplicit, BaseStepImplicit
3-
from .step_termination import *
3+
from .step_termination import BaseTermination, CurrentTermination, VoltageTermination, CustomTermination, CrateTermination, _read_termination
44

55
__all__ = ['base_step', 'step_termination', 'steps']

src/pybamm/experiment/step/base_step.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ def __init__(
6767
tags=None,
6868
start_time=None,
6969
description=None,
70-
direction=None,
70+
direction: str | None = None,
7171
):
72+
potential_directions = ["charge", "discharge", "rest", None]
73+
if direction not in potential_directions:
74+
raise ValueError(
75+
f"Invalid direction: {direction}. Must be one of {potential_directions}"
76+
)
77+
self.input_duration = duration
7278
self.input_duration = duration
7379
self.input_value = value
7480
# Check if drive cycle
@@ -386,11 +392,11 @@ def value_based_charge_or_discharge(self):
386392
init_curr = self.value
387393
sign = np.sign(init_curr)
388394
if sign == 0:
389-
return "Rest"
395+
return "rest"
390396
elif sign > 0:
391-
return "Discharge"
397+
return "discharge"
392398
else:
393-
return "Charge"
399+
return "charge"
394400

395401
def record_tags(
396402
self,

src/pybamm/experiment/step/step_termination.py

+47-10
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ class BaseTermination:
1414
The value at which the event is triggered
1515
"""
1616

17-
def __init__(self, value):
17+
def __init__(self, value, operator=None):
1818
self.value = value
19+
if operator not in ["<", ">", None]:
20+
raise ValueError(f"Invalid operator: {operator}")
21+
self.operator = operator
1922

2023
def get_event(self, variables, step):
2124
"""
@@ -67,9 +70,19 @@ def get_event(self, variables, step):
6770
"""
6871
See :meth:`BaseTermination.get_event`
6972
"""
73+
operator = self.operator
74+
if operator == ">":
75+
expr = self.value - variables["Current [A]"]
76+
event_string = f"Current [A] > {self.value} [A] [experiment]"
77+
elif operator == "<":
78+
expr = variables["Current [A]"] - self.value
79+
event_string = f"Current [A] < {self.value} [A] [experiment]"
80+
else:
81+
expr = abs(variables["Current [A]"]) - self.value
82+
event_string = f"abs(Current [A]) < {self.value} [A] [experiment]"
7083
event = pybamm.Event(
71-
"Current cut-off [A] [experiment]",
72-
abs(variables["Current [A]"]) - self.value,
84+
event_string,
85+
expr,
7386
)
7487
return event
7588

@@ -89,24 +102,48 @@ def get_event(self, variables, step):
89102
# figure out whether the voltage event is greater than the starting
90103
# voltage (charge) or less (discharge) and set the sign of the
91104
# event accordingly
92-
direction = step.direction.capitalize()
93-
if direction == "Charge":
105+
operator = self.operator
106+
if operator is None:
107+
direction = step.direction
108+
if direction == "charge":
109+
operator = ">"
110+
elif direction == "discharge":
111+
operator = "<"
112+
else:
113+
# No event for rest steps
114+
return None
115+
116+
if operator == ">":
94117
sign = -1
95-
elif direction == "Discharge":
118+
else:
119+
# operator can only be "<" or ">"
96120
sign = 1
97-
elif direction == "Rest":
98-
# No event for rest steps
99-
return None
100121

101122
# Event should be positive at initial conditions for both
102123
# charge and discharge
103124
event = pybamm.Event(
104-
f"{direction} voltage cut-off [V] [experiment]",
125+
f"Voltage {operator} {self.value} [V] [experiment]",
105126
sign * (variables["Battery voltage [V]"] - self.value),
106127
)
107128
return event
108129

109130

131+
class Voltage:
132+
def __gt__(self, value):
133+
return VoltageTermination(value, operator=">")
134+
135+
def __lt__(self, value):
136+
return VoltageTermination(value, operator="<")
137+
138+
139+
class Current:
140+
def __gt__(self, value):
141+
return CurrentTermination(value, operator=">")
142+
143+
def __lt__(self, value):
144+
return CurrentTermination(value, operator="<")
145+
146+
110147
class CustomTermination(BaseTermination):
111148
"""
112149
Define a custom termination event using a function. This can be used to create an

src/pybamm/input/parameters/lithium_ion/Ai2020.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def graphite_electrolyte_exchange_current_density_Dualfoil1998(
4545
4646
References
4747
----------
48-
.. [2] http://www.cchem.berkeley.edu/jsngrp/fortran.html
48+
.. [2] John Newman, Dualfoil
4949
5050
Parameters
5151
----------
@@ -219,7 +219,7 @@ def lico2_diffusivity_Dualfoil1998(sto, T):
219219
220220
References
221221
----------
222-
.. [1] http://www.cchem.berkeley.edu/jsngrp/fortran.html
222+
.. [1] John Newman, Dualfoil
223223
224224
Parameters
225225
----------
@@ -247,7 +247,7 @@ def lico2_electrolyte_exchange_current_density_Dualfoil1998(c_e, c_s_surf, c_s_m
247247
248248
References
249249
----------
250-
.. [2] http://www.cchem.berkeley.edu/jsngrp/fortran.html
250+
.. [2] John Newman, Dualfoil
251251
252252
Parameters
253253
----------

0 commit comments

Comments
 (0)