Skip to content

Commit

Permalink
Merge branch 'develop' into joss
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyPlanden committed Nov 26, 2024
2 parents cd7043e + 2f1a4b4 commit c34cccf
Show file tree
Hide file tree
Showing 136 changed files with 238,586 additions and 10,294 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lychee_links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
--max-retries 5
--skip-missing
--exclude-loopback
--accept 200,429
--accept 200,403,429,999
--exclude "https://tiles.stadiamaps.com/*|https://b.tile.openstreetmap.org/*"
--exclude "https://cartodb-basemaps-c.global.ssl.fastly.net/*"
--exclude "https://events.mapbox.com/*|https://events.mapbox.cn/*|https://api.mapbox.cn/*"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scheduled_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
# Check noxfile.py for associated environment variables
env:
PYBOP_SCHEDULED: 1
FORCE_COLOR: 3

jobs:
# Dynamically create a matrix of OS, Python, and PyBaMM versions
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test_on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
workflow_dispatch:
pull_request:

# Add colors to nox/pytest
env:
FORCE_COLOR: 3

concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
Expand Down
6 changes: 3 additions & 3 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.6.5"
rev: "v0.8.0"
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand All @@ -13,7 +13,7 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=2000']
Expand All @@ -34,7 +34,7 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.1
hooks:
- id: nbstripout
args: ['--keep-output', '--drop-empty-cells']
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@

## Features

- [#282](https://github.com/pybop-team/PyBOP/issues/282) - Restructures the examples directory.
- [#396](https://github.com/pybop-team/PyBOP/issues/396) - Adds `ecm_with_tau.py` example script.
- [#452](https://github.com/pybop-team/PyBOP/issues/452) - Extends `cell_mass` and `approximate_capacity` for half-cell models.
- [#544](https://github.com/pybop-team/PyBOP/issues/544) - Allows iterative plotting using `StandardPlot`.
- [#541](https://github.com/pybop-team/PyBOP/pull/541) - Adds `ScaledLogLikelihood` and `BaseMetaLikelihood` classes.
- [#409](https://github.com/pybop-team/PyBOP/pull/409) - Adds plotting and convergence methods for Monte Carlo sampling. Includes open-access Tesla 4680 dataset for Bayesian inference example. Fixes transformations for sampling.
- [#531](https://github.com/pybop-team/PyBOP/pull/531) - Adds Voronoi optimiser surface plot (`pybop.plot.surface`) for fast optimiser aligned cost visualisation.
- [#532](https://github.com/pybop-team/PyBOP/issues/532) - Adds `linked_parameters` example script which shows how to update linked parameters during design optimisation.
- [#529](https://github.com/pybop-team/PyBOP/issues/529) - Adds `GravimetricPowerDensity` and `VolumetricPowerDensity` costs, along with the mathjax extension for Sphinx.

## Optimisations

- [#512](https://github.com/pybop-team/PyBOP/pull/513) - Refactors `LogPosterior` with attributes pointing to composed likelihood object.
- [#551](https://github.com/pybop-team/PyBOP/pull/551) - Refactors Optimiser arguments, `population_size` and `max_iterations` as default args, improves optimiser docstrings

## Bug Fixes

- [#505](https://github.com/pybop-team/PyBOP/pull/505) - Bug fixes for `LogPosterior` with transformed `GaussianLogLikelihood` likelihood.

## Breaking Changes

# [v24.9.1](https://github.com/pybop-team/PyBOP/tree/v24.9.0) - 2024-09-16
- [#531](https://github.com/pybop-team/PyBOP/pull/531) - Plot methods moved to `pybop.plot` with mostly minimal renaming. For example, `pybop.plot_parameters` is now `pybop.plot.parameters`. Other breaking changes include: `pybop.plot2d` to `pybop.plot.contour`.
- [#526](https://github.com/pybop-team/PyBOP/pull/526) - Refactor `OptimisationResults` classes, with `optim.run()` now return the full object. Adds finite cost value check for optimised parameters.

# [v24.9.1](https://github.com/pybop-team/PyBOP/tree/v24.9.0) - 2024-09-16

## Features

Expand Down Expand Up @@ -53,6 +70,7 @@

## Breaking Changes

- [#499](https://github.com/pybop-team/PyBOP/pull/499) - BPX is added as an optional dependency.
- [#483](https://github.com/pybop-team/PyBOP/pull/483) - Replaces `pybop.MAP` with `pybop.LogPosterior` with an updated call args and bugfixes.
- [#436](https://github.com/pybop-team/PyBOP/pull/436) - **API Change:** The functionality from `BaseCost.evaluate/S1` & `BaseCost._evaluate/S1` is represented in `BaseCost.__call__` & `BaseCost.compute`. `BaseCost.compute` directly acts on the predictions, while `BaseCost.__call__` calls `BaseProblem.evaluate/S1` before `BaseCost.compute`. `compute` has optional args for gradient cost calculations.
- [#424](https://github.com/pybop-team/PyBOP/issues/424) - Replaces the `init_soc` input to `FittingProblem` with the option to pass an initial OCV value, updates `BaseModel` and fixes `multi_model_identification.ipynb` and `spm_electrode_design.ipynb`.
Expand Down
14 changes: 11 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,24 @@ If you have nox installed, to run unit tests, type
nox -s unit
```

Alternatively, to run tests standalone with pytest, run,
For individual tests, use:

```bash
nox -s tests -- tests/unit/test_costs.py::TestCosts::test_costs
```

which will run the specified test, alternatively you can run all tests within a file by removing the trailing `::test_costs` in the above command.

Alternatively, to run tests standalone with pytest, use:

```bash
pytest --unit -v
```

To run individual test files, you can use
To run individual test files with nox, you can use

```bash
pytest tests/unit/path/to/test --unit -v
pytest tests/unit/path/to/test.py --unit -v
```

And for individual tests,
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ These include a wide variety of optimisation problems that require careful consi

Explore our [example notebooks](https://github.com/pybop-team/PyBOP/blob/develop/examples) for hands-on demonstrations:

- [Gravimetric design optimisation (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/notebooks/spm_electrode_design.ipynb)
- [Non-linear constrained ECM parameter identification](https://github.com/pybop-team/PyBOP/blob/develop/examples/notebooks/ecm_trust-constr.ipynb)
- [Optimiser comparison for parameter identification](https://github.com/pybop-team/PyBOP/blob/develop/examples/notebooks/multi_optimiser_identification.ipynb)
- [Parameter identification for spatial pouch cell model](https://github.com/pybop-team/PyBOP/blob/develop/examples/notebooks/pouch_cell_identification.ipynb)
- [Estimating ECM parameters from HPPC pulse](https://github.com/pybop-team/PyBOP/blob/develop/examples/notebooks/equivalent_circuit_identification_hppc.ipynb)
- [Gravimetric design optimisation (SPMe)](https://nbviewer.org/github/pybop-team/PyBOP/blob/develop/examples/notebooks/design_optimisation/energy_based_electrode_design.ipynb)
- [Non-linear constrained ECM parameter identification](https://nbviewer.org/github/pybop-team/PyBOP/blob/develop/examples/notebooks/battery_parameterisation/ecm_trust-constr.ipynb)
- [Optimiser comparison for parameter identification](https://nbviewer.org/github/pybop-team/PyBOP/blob/develop/examples/notebooks/comparison_examples/multi_optimiser_identification.ipynb)
- [Parameter identification for spatial pouch cell model](https://nbviewer.org/github/pybop-team/PyBOP/blob/develop/examples/notebooks/battery_parameterisation/pouch_cell_identification.ipynb)
- [Estimating ECM parameters from HPPC pulse](https://nbviewer.org/github/pybop-team/PyBOP/blob/develop/examples/notebooks/battery_parameterisation/equivalent_circuit_identification_hppc.ipynb)

### Python Scripts

Find additional script-based examples in the [examples directory](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/):

- [UKF parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/spm_UKF.py)
- [BPX format parameter import/export](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/BPX_spm.py)
- [Electrochemical Impendence Spectroscopy (EIS) parameter identification](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/eis_fitting.py)
- [Maximum a Posteriori parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/BPX_spm.py)
- [Gradient-based parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/spm_AdamW.py)
- [UKF parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/comparison_examples/spm_UKF.py)
- [BPX format parameter import/export](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/getting_started/BPX_spm.py)
- [Electrochemical Impendence Spectroscopy (EIS) parameter identification](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/battery_parameterisation/eis_fitting.py)
- [Maximum a Posteriori parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/getting_started/BPX_spm.py)
- [Gradient-based parameter identification (SPM)](https://github.com/pybop-team/PyBOP/blob/develop/examples/scripts/comparison_examples/spm_AdamW.py)


### Supported Methods
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark_optim_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def setup(self, model, parameter_set, optimiser):
Args:
model (pybop.Model): The model class to be benchmarked.
parameter_set (str): The name of the parameter set to be used.
optimiser (pybop.Optimiser): The optimizer class to be used.
optimiser (pybop.Optimiser): The optimiser class to be used.
"""
# Set random seed
set_random_seed()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark_parameterisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ def time_optimiser_ask(self, model, parameter_set, optimiser):
optimiser (pybop.Optimiser): The optimizer class being used.
"""
if optimiser not in [pybop.SciPyMinimize, pybop.SciPyDifferentialEvolution]:
self.optim.pints_optimiser.ask()
self.optim.optimiser.ask()
8 changes: 4 additions & 4 deletions benchmarks/benchmark_track_parameterisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setup(self, model, parameter_set, optimiser):
Args:
model (pybop.Model): The model class to be benchmarked.
parameter_set (str): The name of the parameter set to be used.
optimiser (pybop.Optimiser): The optimizer class to be used.
optimiser (pybop.Optimiser): The optimiser class to be used.
"""
# Set random seed
set_random_seed()
Expand Down Expand Up @@ -121,7 +121,7 @@ def results_tracking(self, model, parameter_set, optimiser):
Args:
model (pybop.Model): The model class being benchmarked (unused).
parameter_set (str): The name of the parameter set being used (unused).
optimiser (pybop.Optimiser): The optimizer class being used (unused).
optimiser (pybop.Optimiser): The optimiser class being used (unused).
"""
x, _ = self.optim.run()
return x
results = self.optim.run()
return results.x
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def pytest_addoption(parser):
"--examples", action="store_true", default=False, help="run examples tests"
)
parser.addoption(
"--plots", action="store_true", default=False, help="run plotting tests"
"--plots", action="store_true", default=False, help="run plot tests"
)
parser.addoption(
"--notebooks", action="store_true", default=False, help="run notebook tests"
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx_design",
"sphinx_copybutton",
"autoapi.extension",
# custom extentions
# custom extensions
"_extension.gallery_directive",
# For extension examples and demos
"myst_parser",
Expand Down
22 changes: 22 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ For those who prefer to install PyBOP from a local clone of the repository or wi
In editable mode, changes you make to the source code will immediately affect the PyBOP installation without the need for reinstallation.

Optional Dependencies
-----------------
``plotly`` - For plotting, PyBOP uses plotly. It can be installed with:

.. code-block:: console
pip install pybop[plot]
``scikit-fem`` - This is a dependency for the multi-dimensional pybamm models, and can be installed using:

.. code-block:: console
pip install pybop[scifem]
``bpx`` - To use the Faraday Institution's Battery Parameter eXchange (BPX) package install the optional requirement:

.. code-block:: console
pip install pybop[bpx]
To install all the optional dependencies, the command ``pip install pybop[all]`` is available. For more information on the optional packages, users are directed towards the `pyproject.toml <https://github.com/pybop-team/PyBOP/blob/develop/pyproject.toml>`_.

Verifying Installation
----------------------

Expand Down
File renamed without changes.
Loading

0 comments on commit c34cccf

Please sign in to comment.