Skip to content

Commit e01afbd

Browse files
committed
convert error messages to f-strings
1 parent 0bc0fe3 commit e01afbd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pydmd/bopdmd.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,10 +1518,8 @@ def fit_econ(self, s, V, t):
15181518
raise ValueError(msg)
15191519

15201520
if (s.ndim != 1 or len(s) != self._svd_rank):
1521-
msg = """
1522-
s must be a 1D numpy.ndarray of length {}.
1523-
"""
1524-
raise ValueError(msg.format(self._svd_rank))
1521+
msg = f"s must be one-dimensional and of length {self._svd_rank}."
1522+
raise ValueError(msg)
15251523

15261524
# Check that V is a 2D numpy.ndarray.
15271525
if (
@@ -1530,10 +1528,11 @@ def fit_econ(self, s, V, t):
15301528
or V.shape[0] != self._svd_rank
15311529
or V.shape[1] != len(self._time)
15321530
):
1533-
msg = """
1534-
V must be a 2D numpy.ndarray with shape ({}, {}).
1535-
"""
1536-
raise ValueError(msg.format(self._svd_rank, len(self._time)))
1531+
msg = (
1532+
"V must be a 2D numpy.ndarray with shape "
1533+
f"({self._svd_rank}, {len(self._time)})."
1534+
)
1535+
raise ValueError(msg)
15371536

15381537
# Set/check the initial guess for the continuous-time DMD eigenvalues.
15391538
if self._init_alpha is None:

0 commit comments

Comments
 (0)