Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## Bug fixes

- Fixes `KeyError: 'min'` in `latexify()` for lithium plating models when certain geometry keys are missing. ([#5245](https://github.com/pybamm-team/PyBaMM/pull/5245))
- Adds `options` property to IDAKLU, fixes pickling issue with `__getstate__` when keys are not available. ([#5234](https://github.com/pybamm-team/PyBaMM/pull/5234))
- Fixed a bug where simulations using output variables in `IDAKLUSolver` couldn't be pickled ([#5225](https://github.com/pybamm-team/PyBaMM/pull/5225))
- Added explicit warning in installation docs about unmaintained Conda recipe due to pybammsolvers split (Fixes #5155). See pull request [#5206](https://github.com/pybamm-team/PyBaMM/pull/5206)
Expand Down
10 changes: 8 additions & 2 deletions src/pybamm/expression_tree/operations/latexify.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ def _get_geometry_displays(self, var):
for var_name, rng in self.model.default_geometry[var.domain[0]].items():
# Trim name (r_n --> r)
name = re.findall(r"(.)_*.*", str(var_name))[0]
rng_min = get_rng_min_max_name(rng, "min")
if "min" in rng:
rng_min = get_rng_min_max_name(rng, "min")
else:
continue

# Take range maximum from the last domain
for _, rng in self.model.default_geometry[var.domain[-1]].items():
rng_max = get_rng_min_max_name(rng, "max")
if "max" in rng:
rng_max = get_rng_min_max_name(rng, "max")
else:
continue

geo_latex = rf"\quad {rng_min} < {name} < {rng_max}"
geo.append(geo_latex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ def test_sympy_preview(self):
filename = f"{uuid.uuid4()}.{ext}"
model_spme.latexify(filename)
os.remove(filename)

def test_latexify_with_lithium_plating(self):
model = pybamm.lithium_ion.SPM(options={"lithium plating": "irreversible"})
# Should not raise KeyError
model.latexify()
Loading