Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Aug 6, 2024
1 parent d5f63d0 commit d0d1bd2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pybop/problems/design_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
else:
initial_state = {"Initial SoC": 1.0} # default value
elif "Initial open-circuit voltage [V]" in initial_state.keys():
warnings.warn(
warnings.warn(
"It is usually better to define an initial state of charge as the "
"initial_state for a DesignProblem because this state will scale with "
"design properties such as the capacity of the battery, as opposed to the "
Expand Down
4 changes: 2 additions & 2 deletions pybop/problems/fitting_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def __init__(
additional_variables = list(set(additional_variables))

if initial_state is not None and "Initial SoC" in initial_state.keys():
warnings.warn(
warnings.warn(
"It is usually better to define an initial open-circuit voltage as the "
"initial_state for a FittingProblem because this value can typically be "
"obtained from the data, unlike the intrinsic initial state of charge. "
"In the case where the fitting parameters do not change the OCV-SOC "
"relationship, the initial state of charge may be passed to the model "
"using, for example, `model.set_initial_state({\"Initial SoC\": 1.0})` "
'using, for example, `model.set_initial_state({"Initial SoC": 1.0})` '
"before constructing the FittingProblem.",
UserWarning,
)
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ def test_fitting_problem(self, parameters, dataset, model, signal):
signal=signal,
initial_state={"Initial SoC": 0.8},
)
assert "It is usually better to define an initial open-circuit voltage" in str(record[0].message)
assert "It is usually better to define an initial open-circuit voltage" in str(
record[0].message
)

# Construct Problem
problem = pybop.FittingProblem(
Expand Down Expand Up @@ -189,7 +191,9 @@ def test_design_problem(self, parameters, experiment, model):
experiment,
initial_state={"Initial open-circuit voltage [V]": 4.0},
)
assert "It is usually better to define an initial state of charge" in str(record[0].message)
assert "It is usually better to define an initial state of charge" in str(
record[0].message
)

# Construct Problem
problem = pybop.DesignProblem(model, parameters, experiment)
Expand Down

0 comments on commit d0d1bd2

Please sign in to comment.