Skip to content

Commit

Permalink
Merge branch 'issue-2703-temperature' into issue-2418-dimensional
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Feb 19, 2023
2 parents 908395a + 889f929 commit b1f1742
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions pybamm/experiments/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import re
import pybamm


examples = """
Expand Down Expand Up @@ -417,30 +417,12 @@ def convert_electric(self, electric):
)
)

def _detect_mistyped_temperatures(self, cond):
if "oC" in cond:
raise ValueError(f"Temperature not written correctly on step: '{cond}'")

def _read_and_drop_temperature(self, cond):
matches = re.findall(r"at\s-*\d+\.*\d*\s*oC", cond)

if len(matches) == 0:
self._detect_mistyped_temperatures(cond)

if self.temperature is None:
pybamm.logger.warning(
"Temperature not found on step: "
f"'{cond}', using temperature "
"from parameter values."
)

else:
pybamm.logger.warning(
f"Temperature not found on step: '{cond}', "
f"using global temperature "
f"({self.temperature}oC) instead"
)

if "oC" in cond:
raise ValueError(f"Temperature not written correctly on step: '{cond}'")
temperature = self.temperature
reduced_cond = cond

Expand Down

0 comments on commit b1f1742

Please sign in to comment.