Skip to content

Commit

Permalink
Merge branch 'develop' into 424-fitting-ocv
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolaCourtier committed Jul 31, 2024
2 parents 6f05cda + 08fa1cb commit 24e40a0
Show file tree
Hide file tree
Showing 17 changed files with 406 additions and 236 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.4"
rev: "v0.5.5"
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down Expand Up @@ -37,4 +37,4 @@ repos:
rev: 0.7.1
hooks:
- id: nbstripout
args: ['--keep-output']
args: ['--keep-output', '--drop-empty-cells']
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
- [#327](https://github.com/pybop-team/PyBOP/issues/327) - Adds the `WeightedCost` subclass, defines when to evaluate a problem and adds the `spm_weighted_cost` example script.
- [#393](https://github.com/pybop-team/PyBOP/pull/383) - Adds Minkowski and SumofPower cost classes, with an example and corresponding tests.
- [#403](https://github.com/pybop-team/PyBOP/pull/403/) - Adds lychee link checking action.

## Bug Fixes

## Breaking Changes

# [v24.6.1](https://github.com/pybop-team/PyBOP/tree/v24.6.1) - 2024-07-31

## Features

- [#313](https://github.com/pybop-team/PyBOP/pull/313/) - Fixes for PyBaMM v24.5, drops support for PyBaMM v23.9, v24.1

## Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ authors:
family-names: Courtier
- given-names: David
family-names: Howey
version: "24.6" # Update this when you release a new version
version: "24.6.1" # Update this when you release a new version
repository-code: 'https://www.github.com/pybop-team/pybop'
2 changes: 1 addition & 1 deletion docs/_static/switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "v24.6 (stable)",
"version": "v24.6",
"url": "https://pybop-docs.readthedocs.io/en/v24.6/",
"url": "https://pybop-docs.readthedocs.io/en/v24.6.1/",
"preferred": true
},
{
Expand Down
120 changes: 67 additions & 53 deletions examples/notebooks/LG_M50_ECM/1-single-pulse-circuit-model.ipynb

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions examples/notebooks/comparing_cost_functions.ipynb

Large diffs are not rendered by default.

66 changes: 41 additions & 25 deletions examples/notebooks/equivalent_circuit_identification.ipynb

Large diffs are not rendered by default.

51 changes: 30 additions & 21 deletions examples/notebooks/multi_model_identification.ipynb

Large diffs are not rendered by default.

111 changes: 62 additions & 49 deletions examples/notebooks/multi_optimiser_identification.ipynb

Large diffs are not rendered by default.

108 changes: 73 additions & 35 deletions examples/notebooks/optimiser_calibration.ipynb

Large diffs are not rendered by default.

40 changes: 28 additions & 12 deletions examples/notebooks/optimiser_interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,31 @@
"# Import the necessary libraries\n",
"import numpy as np\n",
"\n",
"np.random.seed(8)\n",
"\n",
"import pybop"
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"Let's fix the random seed in order to generate consistent output during development, although this does not need to be done in practice."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"np.random.seed(8)"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"## Setup the model, problem, and cost\n",
"\n",
Expand All @@ -43,7 +59,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"id": "5",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -92,7 +108,7 @@
},
{
"cell_type": "markdown",
"id": "4",
"id": "6",
"metadata": {},
"source": [
"## Interacting with the Optimisers\n",
Expand All @@ -110,7 +126,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -125,7 +141,7 @@
},
{
"cell_type": "markdown",
"id": "6",
"id": "8",
"metadata": {},
"source": [
"Next, the `Optimisation` interface is less direct than the previous one, but provides a single class to work with across PyBOP workflows. The options are passed the same way as the above method, through kwargs or get() / set() methods."
Expand All @@ -134,7 +150,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -149,7 +165,7 @@
},
{
"cell_type": "markdown",
"id": "8",
"id": "10",
"metadata": {},
"source": [
"We can show the equivalence of these two methods by comparing the optimiser objects:"
Expand All @@ -158,7 +174,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"id": "11",
"metadata": {},
"outputs": [
{
Expand All @@ -178,7 +194,7 @@
},
{
"cell_type": "markdown",
"id": "10",
"id": "12",
"metadata": {},
"source": [
"For completeness, we can show the optimiser solutions:"
Expand All @@ -187,7 +203,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "13",
"metadata": {},
"outputs": [
{
Expand All @@ -206,7 +222,7 @@
},
{
"cell_type": "markdown",
"id": "12",
"id": "14",
"metadata": {},
"source": [
"## Closing Comments\n",
Expand Down
35 changes: 24 additions & 11 deletions examples/notebooks/pouch_cell_identification.ipynb

Large diffs are not rendered by default.

28 changes: 21 additions & 7 deletions examples/notebooks/spm_AdamW.ipynb

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions examples/notebooks/spm_electrode_design.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pybop"
version = "24.6"
version = "24.6.1"
authors = [
{name = "The PyBOP Team"},
]
Expand All @@ -26,7 +26,7 @@ classifiers = [
]
requires-python = ">=3.9, <3.13"
dependencies = [
"pybamm>=24.5rc2",
"pybamm>=24.5",
"numpy>=1.16, <2.0",
"scipy>=1.3",
"pints>=0.5",
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
python_version=("3.9" "3.10" "3.11" "3.12")
os=("ubuntu-latest" "windows-latest" "macos-13" "macos-14")
# This command fetches the last PyBaMM version excluding release candidates from PyPI
#pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 1 | paste -sd " " -))
pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 1 | paste -sd " " -))

# This command fetches the last PyBaMM versions including release candidates from PyPI
pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | tail -n 1 | paste -sd " " -))
#pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | tail -n 1 | paste -sd " " -))

# open dict
json='{
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def test_costs(self, cost):
cost([1.1])

# Test option setting
cost.set_fail_gradient(1)
cost.set_fail_gradient(10)
assert cost._de == 10

if not isinstance(cost, (pybop.ObserverCost, pybop.MAP)):
e, de = cost.evaluateS1([0.5])
Expand Down

0 comments on commit 24e40a0

Please sign in to comment.