Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rename is_static_gain method in LTI systems to _isstatic#524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletionscontrol/statesp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -288,7 +288,7 @@ def __init__(self, *args, **kwargs):
if len(args) == 4:
if 'dt' in kwargs:
dt = kwargs['dt']
elif self.is_static_gain():
elif self._isstatic():
dt = None
else:
dt = config.defaults['control.default_dt']
Expand All@@ -300,7 +300,7 @@ def __init__(self, *args, **kwargs):
try:
dt = args[0].dt
except AttributeError:
if self.is_static_gain():
if self._isstatic():
dt = None
else:
dt = config.defaults['control.default_dt']
Expand DownExpand Up@@ -1213,7 +1213,7 @@ def dcgain(self):
gain = np.tile(np.nan, (self.noutputs, self.ninputs))
return np.squeeze(gain)

defis_static_gain(self):
def_isstatic(self):
"""True if and only if the system has no dynamics, that is,
if A and B are zero. """
return not np.any(self.A) and not np.any(self.B)
Expand Down
16 changes: 8 additions & 8 deletionscontrol/tests/statesp_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -383,7 +383,7 @@ def test_freq_resp(self):
mag, phase, omega = sys.freqresp(true_omega)
np.testing.assert_almost_equal(mag, true_mag)

deftest_is_static_gain(self):
deftest__isstatic(self):
A0 = np.zeros((2,2))
A1 = A0.copy()
A1[0,1] = 1.1
Expand All@@ -394,13 +394,13 @@ def test_is_static_gain(self):
C1 = np.eye(2)
D0 = 0
D1 = np.ones((2,1))
assert StateSpace(A0, B0, C1, D1).is_static_gain()
assert not StateSpace(A1, B0, C1, D1).is_static_gain()
assert not StateSpace(A0, B1, C1, D1).is_static_gain()
assert not StateSpace(A1, B1, C1, D1).is_static_gain()
assert StateSpace(A0, B0, C0, D0).is_static_gain()
assert StateSpace(A0, B0, C0, D1).is_static_gain()
assert StateSpace(A0, B0, C1, D0).is_static_gain()
assert StateSpace(A0, B0, C1, D1)._isstatic()
assert not StateSpace(A1, B0, C1, D1)._isstatic()
assert not StateSpace(A0, B1, C1, D1)._isstatic()
assert not StateSpace(A1, B1, C1, D1)._isstatic()
assert StateSpace(A0, B0, C0, D0)._isstatic()
assert StateSpace(A0, B0, C0, D1)._isstatic()
assert StateSpace(A0, B0, C1, D0)._isstatic()

@slycotonly
def test_minreal(self):
Expand Down
18 changes: 9 additions & 9 deletionscontrol/tests/xferfcn_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -406,7 +406,7 @@ def test_slice(self):
assert (sys1.ninputs, sys1.noutputs) == (2, 1)
assert sys1.dt == 0.5

deftest_is_static_gain(self):
deftest__isstatic(self):
numstatic = 1.1
denstatic = 1.2
numdynamic = [1, 1]
Expand All@@ -415,18 +415,18 @@ def test_is_static_gain(self):
denstaticmimo = [[[1.9,], [1.2,]], [[1.2,], [0.8,]]]
numdynamicmimo = [[[1.1, 0.9], [1.2]], [[1.2], [0.8]]]
dendynamicmimo = [[[1.1, 0.7], [0.2]], [[1.2], [0.8]]]
assert TransferFunction(numstatic, denstatic).is_static_gain()
assert TransferFunction(numstaticmimo, denstaticmimo).is_static_gain()
assert TransferFunction(numstatic, denstatic)._isstatic()
assert TransferFunction(numstaticmimo, denstaticmimo)._isstatic()

assert not TransferFunction(numstatic, dendynamic).is_static_gain()
assert not TransferFunction(numdynamic, dendynamic).is_static_gain()
assert not TransferFunction(numdynamic, denstatic).is_static_gain()
assert not TransferFunction(numstatic, dendynamic).is_static_gain()
assert not TransferFunction(numstatic, dendynamic)._isstatic()
assert not TransferFunction(numdynamic, dendynamic)._isstatic()
assert not TransferFunction(numdynamic, denstatic)._isstatic()
assert not TransferFunction(numstatic, dendynamic)._isstatic()

assert not TransferFunction(numstaticmimo,
dendynamicmimo).is_static_gain()
dendynamicmimo)._isstatic()
assert not TransferFunction(numdynamicmimo,
denstaticmimo).is_static_gain()
denstaticmimo)._isstatic()

@pytest.mark.parametrize("omega, resp",
[(1, np.array([[-0.5 - 0.5j]])),
Expand Down
2 changes: 1 addition & 1 deletioncontrol/timeresp.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1122,7 +1122,7 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
pts_per_cycle = 25 # Number of points divide a period of oscillation
log_decay_percent = np.log(100) # Factor of reduction for real pole decays

if sys.is_static_gain():
if sys._isstatic():
tfinal = default_tfinal
dt = sys.dt if isdtime(sys, strict=True) else default_dt
elif isdtime(sys, strict=True):
Expand Down
6 changes: 3 additions & 3 deletionscontrol/xferfcn.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -214,7 +214,7 @@ def __init__(self, *args, **kwargs):
# no dt given in positional arguments
if 'dt' in kwargs:
dt = kwargs['dt']
elif self.is_static_gain():
elif self._isstatic():
dt = None
else:
dt = config.defaults['control.default_dt']
Expand All@@ -228,7 +228,7 @@ def __init__(self, *args, **kwargs):
try:
dt = args[0].dt
except AttributeError:
if self.is_static_gain():
if self._isstatic():
dt = None
else:
dt = config.defaults['control.default_dt']
Expand DownExpand Up@@ -1084,7 +1084,7 @@ def _dcgain_cont(self):
gain[i][j] = np.nan
return np.squeeze(gain)

defis_static_gain(self):
def_isstatic(self):
"""returns True if and only if all of the numerator and denominator
polynomials of the (possibly MIMO) transfer function are zeroth order,
that is, if the system has no dynamics. """
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp