Skip to content

Commit

Permalink
Merge branch 'develop' into issue-3101-experiment-starting-solution
Browse files Browse the repository at this point in the history
  • Loading branch information
brosaplanella committed Aug 10, 2023
2 parents efc08b6 + f4dfbe7 commit 323c3fe
Show file tree
Hide file tree
Showing 202 changed files with 2,090 additions and 1,492 deletions.
20 changes: 17 additions & 3 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@
"example",
"doc",
"test",
"tutorial"
"tutorial",
"review"
]
},
{
Expand Down Expand Up @@ -610,7 +611,9 @@
"avatar_url": "https://avatars.githubusercontent.com/u/104268427?v=4",
"profile": "https://github.com/arjxn-py",
"contributions": [
"infra"
"infra",
"code",
"doc"
]
},
{
Expand All @@ -629,7 +632,8 @@
"profile": "https://www.aboutenergy.io/",
"contributions": [
"code",
"bug"
"bug",
"ideas"
]
},
{
Expand Down Expand Up @@ -660,6 +664,16 @@
"code",
"test"
]
},
{
"login": "ejfdickinson",
"name": "ejfdickinson",
"avatar_url": "https://avatars.githubusercontent.com/u/116663050?v=4",
"profile": "https://github.com/ejfdickinson",
"contributions": [
"ideas",
"bug"
]
}
],
"contributorsPerLine": 7,
Expand Down
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
0054efe388d2d17301f7e0554449eac9a7d3b7fc
# activated pre-commit for notebooks - https://github.com/pybamm-team/PyBaMM/pull/3110
a63e49ece0f9336d1f5c2562f7459e555c6e6693
# activated standard pre-commits - https://github.com/pybamm-team/PyBaMM/pull/3192
5273214b585c5a4286609aed40e0b092d0e05f42
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Please add a line in the relevant section of [CHANGELOG.md](https://github.com/p

# Key checklist:

- [ ] No style issues: `$ pre-commit run` (see [CONTRIBUTING.md](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md#installing-and-using-pre-commit) for how to set this up to run automatically when committing locally, in just two lines of code)
- [ ] All tests pass: `$ python run-tests.py --all`
- [ ] The documentation builds: `$ python run-tests.py --doctest`
- [ ] No style issues: `$ pre-commit run` (or `$ nox -s pre-commit`) (see [CONTRIBUTING.md](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md#installing-and-using-pre-commit) for how to set this up to run automatically when committing locally, in just two lines of code)
- [ ] All tests pass: `$ python run-tests.py --all` (or `$ nox -s tests`)
- [ ] The documentation builds: `$ python run-tests.py --doctest` (or `$ nox -s doctests`)

You can run unit and doctests together at once, using `$ python run-tests.py --quick`.
You can run integration tests, unit tests, and doctests together at once, using `$ python run-tests.py --quick` (or `$ nox -s quick`).

## Further checks:

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:

# cache Lychee results to avoid hitting rate limits
# cache Lychee results to avoid hitting rate limits
- name: Restore lychee cache
uses: actions/cache@v3
with:
Expand All @@ -41,8 +41,9 @@ jobs:
--exclude-loopback
--exclude https://twitter.com/pybamm_
--exclude "https://doi\.org|www.sciencedirect\.com/*"
--exclude https://www.rse.ox.ac.uk
--accept 200,429
--exclude-path ./CHANGELOG.md
--exclude-path ./CHANGELOG.md
--exclude-path ./scripts/update_version.py
'./**/*.rst'
'./**/*.md'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/need_reply_remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: |
github.event.comment.author_association != 'OWNER' &&
github.event.comment.author_association != 'COLLABORATOR' &&
github.repository-owner == 'pybamm-team'
github.repository_owner == 'pybamm-team'
steps:
- name: Remove needs-reply label
uses: octokit/[email protected]
Expand All @@ -22,4 +22,4 @@ jobs:
issue: ${{ github.event.issue.number }}
label: needs-reply
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/needs_reply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: github.repository-owner == 'pybamm-team'
if: github.repository_owner == 'pybamm-team'
steps:
- name: Close old issues that need reply
uses: dwieeb/needs-reply@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-label: needs-reply
issue-label: needs-reply
8 changes: 4 additions & 4 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Run all unit tests and integration tests for all Python versions
# Run all unit tests and integration tests for all Python versions
# and platforms at 3am UTC every day and on PRs to the main branch
name: Scheduled

on:
workflow_dispatch:
pull_request:
branches:
branches:
- main

# Run everyday at 3 am UTC
Expand Down Expand Up @@ -119,13 +119,13 @@ jobs:
build-apple-mseries:
needs: style
runs-on: [self-hosted, macOS, ARM64]
env:
env:
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Install python & create virtualenv
Expand Down
71 changes: 16 additions & 55 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- id: setup-python
name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check out PyBaMM repository
uses: actions/checkout@v3

# Install and cache apt packages
- name: Install Linux system dependencies
Expand All @@ -68,73 +64,59 @@ jobs:
sudo dot -c
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
# Added fixes to homebrew installs:
# rm -f /usr/local/bin/2to3
# (see https://github.com/actions/virtual-environments/issues/2322)
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_GOOGLE_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
# Speed up CI
NONINTERACTIVE: 1
run: |
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
brew analytics off
brew update
brew install graphviz openblas
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=8.0.5

- name: Install standard Python dependencies
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install nox
pip install --upgrade pip wheel setuptools nox
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
if: matrix.os == 'ubuntu-latest'
with:
path: |
# Repository files
${{ github.workspace }}/.nox/pybamm-requires/
${{ github.workspace }}/pybind11/
${{ github.workspace }}/install_KLU_Sundials/
# Headers and dynamic library files for SuiteSparse and SUNDIALS
${{ env.HOME }}/.local/lib/
${{ env.HOME }}/.local/include/
${{ env.HOME }}/.local/examples/
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/install_KLU_Sundials.py') }}
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: nox -s pybamm-requires

- name: Cache unit tests nox environment for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions
uses: actions/cache@v3
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
with:
path: ${{ github.workspace }}/.nox/unit/
key: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }}

- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
run: nox -s unit

- name: Cache coverage nox environment for GNU/Linux with Python 3.11
uses: actions/cache@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
with:
path: ${{ github.workspace }}/.nox/coverage/
key: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py', '**/.coveragerc') }}

- name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: nox -s coverage
Expand All @@ -143,35 +125,14 @@ jobs:
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/[email protected]

- name: Cache integration tests nox environment for GNU/Linux with Python 3.11
uses: actions/cache@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
with:
path: ${{ github.workspace }}/.nox/integration/
key: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }}

- name: Run integration tests for GNU/Linux with Python 3.11
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: nox -s integration

- name: Cache doctests nox environment for GNU/Linux with Python 3.11
uses: actions/cache@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
with:
path: ${{ github.workspace }}/.nox/doctests/
key: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py', '**/docs/requirements.txt') }}

- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: nox -s doctests

- name: Cache examples nox environment for GNU/Linux with Python 3.11
uses: actions/cache@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
with:
path: ${{ github.workspace }}/.nox/examples/
key: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }}

- name: Install dev dependencies and run example tests for GNU/Linux with Python 3.11
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: nox -s examples
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,9 @@ results/
!docs/source/examples/notebooks/models/spm1.png
!docs/source/examples/notebooks/models/spm2.png

# do not ignore images in _static folder in docs
!docs/_static/favicon/favicon.png
!docs/_static/pybamm_logo.png

# tests
test_callback.log
22 changes: 21 additions & 1 deletion .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.0.280"
rev: "v0.0.282"
hooks:
- id: ruff
args: [--fix, --ignore=E741, --exclude=__init__.py]
Expand All @@ -21,3 +21,23 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies: [black==22.12.0]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-type-ignore
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
12 changes: 7 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# .readthedocs.yml
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

Expand Down Expand Up @@ -34,7 +34,9 @@ build:

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
install:
- method: pip
path: .
extra_requirements:
- docs
- all
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Features
- Spherical and cylindrical shell domains can now be solved with any boundary conditions ([#3237](https://github.com/pybamm-team/PyBaMM/pull/3237))
- Processed variables now get the spatial variables automatically, allowing plotting of more generic models ([#3234](https://github.com/pybamm-team/PyBaMM/pull/3234))

- Double-layer capacity can now be provided as a function of temperature ([#3174](https://github.com/pybamm-team/PyBaMM/pull/3174))
## Breaking changes

- Numpy functions now work with PyBaMM symbols (e.g. `np.exp(pybamm.Symbol("a"))` returns `pybamm.Exp(pybamm.Symbol("a"))`). This means that parameter functions can be specified using numpy functions instead of pybamm functions. Additionally, combining numpy arrays with pybamm objects now works (the numpy array is converted to a pybamm array) ([#3205](https://github.com/pybamm-team/PyBaMM/pull/3205))

## Bug fixes

- Fixed a bug where the "basic" lithium-ion models gave incorrect results when using nonlinear particle diffusivity ([#3207](https://github.com/pybamm-team/PyBaMM/pull/3207))
- Particle size distributions now work with SPMe and NewmanTobias models ([#3207](https://github.com/pybamm-team/PyBaMM/pull/3207))
- Fix to simulate c_rate steps with drive cycles ([#3186](https://github.com/pybamm-team/PyBaMM/pull/3186))
- Always save last cycle in experiment, to fix issues with `starting_solution` and `last_state` ([#3177](https://github.com/pybamm-team/PyBaMM/pull/3177))
- Fix simulations with `starting_solution` to work with `start_time` experiments ([#3177](https://github.com/pybamm-team/PyBaMM/pull/3177))
- Fix SEI Example Notebook ([#3166](https://github.com/pybamm-team/PyBaMM/pull/3166))
- Thevenin() model is now constructed with standard variables: `Time [s]`, `Time [min]`, `Time [h]` ([#3143](https://github.com/pybamm-team/PyBaMM/pull/3143))
- Error generated when invalid parameter values are passed ([#3132](https://github.com/pybamm-team/PyBaMM/pull/3132))
- Parameters in `Prada2013` have been updated to better match those given in the paper, which is a 2.3 Ah cell, instead of the mix-and-match with the 1.1 Ah cell from Lain2019 ([#3096](https://github.com/pybamm-team/PyBaMM/pull/3096))
- Thevenin() model is now constructed with standard variables: `Time [s]`, `Time [min]`, `Time [h]` ([#3143](https://github.com/pybamm-team/PyBaMM/pull/3143))



## Breaking changes

- Added option to use an empirical hysteresis model for the diffusivity and exchange-current density ([#3194](https://github.com/pybamm-team/PyBaMM/pull/3194))
- Double-layer capacity can now be provided as a function of temperature ([#3174](https://github.com/pybamm-team/PyBaMM/pull/3174))
- `pybamm_install_jax` is deprecated. It is now replaced with `pip install pybamm[jax]` ([#3163](https://github.com/pybamm-team/PyBaMM/pull/3163))
- PyBaMM now has optional dependencies that can be installed with the pattern `pip install pybamm[option]` e.g. `pybamm[plot]` ([#3044](https://github.com/pybamm-team/PyBaMM/pull/3044))

# [v23.5](https://github.com/pybamm-team/PyBaMM/tree/v23.5) - 2023-06-18
Expand Down
Loading

0 comments on commit 323c3fe

Please sign in to comment.