Skip to content

Commit 89c22c1

Browse files
committed
use isdtime in StateSpace.__str__()
1 parent 0a7cd53 commit 89c22c1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

control/statesp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ def __str__(self):
391391
"\n ".join(str(M).splitlines()))
392392
for Mvar, M in zip(["A", "B", "C", "D"],
393393
[self.A, self.B, self.C, self.D])])
394-
# TODO: replace with standard calls to lti functions
395-
if (type(self.dt) == bool and self.dt is True):
396-
string += "\ndt unspecified\n"
397-
elif (not (self.dt is None) and type(self.dt) != bool and self.dt > 0):
398-
string += "\ndt = " + self.dt.__str__() + "\n"
394+
if self.isdtime(strict=True):
395+
if self.dt is True:
396+
string += "\ndt unspecified\n"
397+
else:
398+
string += f"\ndt = {self.dt}\n"
399399
return string
400400

401401
# represent to implement a re-loadable version

control/tests/statesp_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def test_str(self, sys322):
745745
tsysdtunspec = StateSpace(tsys.A, tsys.B, tsys.C, tsys.D, True)
746746
assert str(tsysdtunspec) == tref + "\ndt unspecified\n"
747747
sysdt1 = StateSpace(tsys.A, tsys.B, tsys.C, tsys.D, 1.)
748-
assert str(sysdt1) == tref + "\ndt = 1.0\n"
748+
assert str(sysdt1) == tref + "\ndt = {}\n".format(1.)
749749

750750
def test_pole_static(self):
751751
"""Regression: pole() of static gain is empty array."""

0 commit comments

Comments
 (0)