Skip to content

Commit d75c395

Browse files
sawyerbfullerbnavigator
authored andcommitted
rename is_static_gain method in LTI systems to _isstatic because it should be private and to be consistent with iosys
1 parent ff7d827 commit d75c395

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

control/statesp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def __init__(self, *args, **kwargs):
288288
if len(args) == 4:
289289
if 'dt' in kwargs:
290290
dt = kwargs['dt']
291-
elif self.is_static_gain():
291+
elif self._isstatic():
292292
dt = None
293293
else:
294294
dt = config.defaults['control.default_dt']
@@ -300,7 +300,7 @@ def __init__(self, *args, **kwargs):
300300
try:
301301
dt = args[0].dt
302302
except AttributeError:
303-
if self.is_static_gain():
303+
if self._isstatic():
304304
dt = None
305305
else:
306306
dt = config.defaults['control.default_dt']
@@ -1213,7 +1213,7 @@ def dcgain(self):
12131213
gain = np.tile(np.nan, (self.noutputs, self.ninputs))
12141214
return np.squeeze(gain)
12151215

1216-
def is_static_gain(self):
1216+
def _isstatic(self):
12171217
"""True if and only if the system has no dynamics, that is,
12181218
if A and B are zero. """
12191219
return not np.any(self.A) and not np.any(self.B)

control/tests/statesp_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def test_freq_resp(self):
383383
mag, phase, omega = sys.freqresp(true_omega)
384384
np.testing.assert_almost_equal(mag, true_mag)
385385

386-
def test_is_static_gain(self):
386+
def test__isstatic(self):
387387
A0 = np.zeros((2,2))
388388
A1 = A0.copy()
389389
A1[0,1] = 1.1
@@ -394,13 +394,13 @@ def test_is_static_gain(self):
394394
C1 = np.eye(2)
395395
D0 = 0
396396
D1 = np.ones((2,1))
397-
assert StateSpace(A0, B0, C1, D1).is_static_gain()
398-
assert not StateSpace(A1, B0, C1, D1).is_static_gain()
399-
assert not StateSpace(A0, B1, C1, D1).is_static_gain()
400-
assert not StateSpace(A1, B1, C1, D1).is_static_gain()
401-
assert StateSpace(A0, B0, C0, D0).is_static_gain()
402-
assert StateSpace(A0, B0, C0, D1).is_static_gain()
403-
assert StateSpace(A0, B0, C1, D0).is_static_gain()
397+
assert StateSpace(A0, B0, C1, D1)._isstatic()
398+
assert not StateSpace(A1, B0, C1, D1)._isstatic()
399+
assert not StateSpace(A0, B1, C1, D1)._isstatic()
400+
assert not StateSpace(A1, B1, C1, D1)._isstatic()
401+
assert StateSpace(A0, B0, C0, D0)._isstatic()
402+
assert StateSpace(A0, B0, C0, D1)._isstatic()
403+
assert StateSpace(A0, B0, C1, D0)._isstatic()
404404

405405
@slycotonly
406406
def test_minreal(self):

control/tests/xferfcn_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def test_slice(self):
406406
assert (sys1.ninputs, sys1.noutputs) == (2, 1)
407407
assert sys1.dt == 0.5
408408

409-
def test_is_static_gain(self):
409+
def test__isstatic(self):
410410
numstatic = 1.1
411411
denstatic = 1.2
412412
numdynamic = [1, 1]
@@ -415,18 +415,18 @@ def test_is_static_gain(self):
415415
denstaticmimo = [[[1.9,], [1.2,]], [[1.2,], [0.8,]]]
416416
numdynamicmimo = [[[1.1, 0.9], [1.2]], [[1.2], [0.8]]]
417417
dendynamicmimo = [[[1.1, 0.7], [0.2]], [[1.2], [0.8]]]
418-
assert TransferFunction(numstatic, denstatic).is_static_gain()
419-
assert TransferFunction(numstaticmimo, denstaticmimo).is_static_gain()
418+
assert TransferFunction(numstatic, denstatic)._isstatic()
419+
assert TransferFunction(numstaticmimo, denstaticmimo)._isstatic()
420420

421-
assert not TransferFunction(numstatic, dendynamic).is_static_gain()
422-
assert not TransferFunction(numdynamic, dendynamic).is_static_gain()
423-
assert not TransferFunction(numdynamic, denstatic).is_static_gain()
424-
assert not TransferFunction(numstatic, dendynamic).is_static_gain()
421+
assert not TransferFunction(numstatic, dendynamic)._isstatic()
422+
assert not TransferFunction(numdynamic, dendynamic)._isstatic()
423+
assert not TransferFunction(numdynamic, denstatic)._isstatic()
424+
assert not TransferFunction(numstatic, dendynamic)._isstatic()
425425

426426
assert not TransferFunction(numstaticmimo,
427-
dendynamicmimo).is_static_gain()
427+
dendynamicmimo)._isstatic()
428428
assert not TransferFunction(numdynamicmimo,
429-
denstaticmimo).is_static_gain()
429+
denstaticmimo)._isstatic()
430430

431431
@pytest.mark.parametrize("omega, resp",
432432
[(1, np.array([[-0.5 - 0.5j]])),

control/timeresp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
11221122
pts_per_cycle = 25 # Number of points divide a period of oscillation
11231123
log_decay_percent = np.log(100) # Factor of reduction for real pole decays
11241124

1125-
if sys.is_static_gain():
1125+
if sys._isstatic():
11261126
tfinal = default_tfinal
11271127
dt = sys.dt if isdtime(sys, strict=True) else default_dt
11281128
elif isdtime(sys, strict=True):

control/xferfcn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def __init__(self, *args, **kwargs):
214214
# no dt given in positional arguments
215215
if 'dt' in kwargs:
216216
dt = kwargs['dt']
217-
elif self.is_static_gain():
217+
elif self._isstatic():
218218
dt = None
219219
else:
220220
dt = config.defaults['control.default_dt']
@@ -228,7 +228,7 @@ def __init__(self, *args, **kwargs):
228228
try:
229229
dt = args[0].dt
230230
except AttributeError:
231-
if self.is_static_gain():
231+
if self._isstatic():
232232
dt = None
233233
else:
234234
dt = config.defaults['control.default_dt']
@@ -1084,7 +1084,7 @@ def _dcgain_cont(self):
10841084
gain[i][j] = np.nan
10851085
return np.squeeze(gain)
10861086

1087-
def is_static_gain(self):
1087+
def _isstatic(self):
10881088
"""returns True if and only if all of the numerator and denominator
10891089
polynomials of the (possibly MIMO) transfer function are zeroth order,
10901090
that is, if the system has no dynamics. """

0 commit comments

Comments
 (0)