Skip to content

Commit

Permalink
pybamm-team#2703 remove warning if temperature not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Feb 19, 2023
1 parent a48b28f commit 889f929
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 889f929

Please sign in to comment.