[Bug]: Deprecation warning for "electrode diffusivity" names the old and new parameter the wrong way round

Open Beginner friendly
#6,059 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing

Research direction

In util.py, inspect FuzzyDict.__getitem__ and locate the unit test that checks the deprecation warning for the renamed electrode diffusivity parameter. Update the warning text and assert its expected message, then run that focused test. Done means looking up the old parameter name returns the new parameter value and reports the old and new names in the correct order.

Written by the indexing model from the issue text.

Description

PyBaMM Version

main @ 635340c09

Python Version

3.13

Describe the bug

The parameter was renamed from "... electrode diffusivity [m2.s-1]" to "... particle diffusivity [m2.s-1]" (#3770). When you look up the old name, FuzzyDict.__getitem__ (util.py) warns that the new name has been renamed to the old one and says it is using the old one. In fact it returns the value of the new one. The unit test only checks the warning class, not the text.

Steps to Reproduce
import warnings

import pybamm

params = pybamm.ParameterValues("Chen2020")
with warnings.catch_warnings(record=True) as w:
    warnings.simplefilter("always")
    params["Negative electrode diffusivity [m2.s-1]"]
print(w[0].message)
Relevant log output
The parameter 'Negative particle diffusivity [m2.s-1]' has been renamed to 'Negative electrode diffusivity [m2.s-1]' and will be removed in a future release. Using 'Negative electrode diffusivity [m2.s-1]'

Expected: "The parameter 'Negative electrode diffusivity [m2.s-1]' has been renamed to 'Negative particle diffusivity [m2.s-1]' ... Using 'Negative particle diffusivity [m2.s-1]'". I'm happy to open a PR that swaps the two and asserts the message in the test.

Dominant language
Python
Stars
1.7k
Forks
808
Avg merge
4d 4h
Merged PRs (30d)
55

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pybamm-team/PyBaMM

All issues in pybamm-team/PyBaMM

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.