From c70a377fc82e2bbe637e24760cf105f957843748 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 20 Nov 2022 07:24:43 +0200 Subject: [PATCH 1/5] Use `raise NotImplentedError`, not `NotImplemented` in InputOutputSystem._rhs --- control/iosys.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/control/iosys.py b/control/iosys.py index df75f3b54..49ab29c77 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -366,8 +366,8 @@ def _rhs(self, t, x, u): you may want to use :meth:`dynamics`. """ - NotImplemented("Evaluation not implemented for system of type ", - type(self)) + raise NotImplementedError("Evaluation not implemented for system of type ", + type(self)) def dynamics(self, t, x, u, params=None): """Compute the dynamics of a differential or difference equation. From 3732a2132402033ab14c7f0716b44b71e466fc48 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 20 Nov 2022 07:26:06 +0200 Subject: [PATCH 2/5] Correct warnings.warn call in modelsimp.markov --- control/modelsimp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/modelsimp.py b/control/modelsimp.py index 432b76b96..b1c1ae31c 100644 --- a/control/modelsimp.py +++ b/control/modelsimp.py @@ -476,7 +476,7 @@ def markov(Y, U, m=None, transpose=False): # Make sure there is enough data to compute parameters if m > n: - warn.warning("Not enough data for requested number of parameters") + warnings.warn("Not enough data for requested number of parameters") # # Original algorithm (with mapping to standard order) From 3f7b640c521c28fd8caf11a9fd70d5eb8a89e907 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 20 Nov 2022 07:26:33 +0200 Subject: [PATCH 3/5] Remove non-existent __all__ entry in optimal --- control/optimal.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/control/optimal.py b/control/optimal.py index 4913cc341..de45a8dd0 100644 --- a/control/optimal.py +++ b/control/optimal.py @@ -20,8 +20,6 @@ from .exception import ControlNotImplemented from .timeresp import TimeResponseData -__all__ = ['find_optimal_input'] - # Define module default parameter values _optimal_defaults = { 'optimal.minimize_method': None, From 5d7b79888520276c3129ab0923a83f2cc75da0c7 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 20 Nov 2022 07:26:55 +0200 Subject: [PATCH 4/5] Import ControlSlycot exception in statesp --- control/statesp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/control/statesp.py b/control/statesp.py index a2fa3dd73..af549cff6 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -59,6 +59,8 @@ from scipy.signal import cont2discrete from scipy.signal import StateSpace as signalStateSpace from warnings import warn + +from .exception import ControlSlycot from .frdata import FrequencyResponseData from .lti import LTI, _process_frequency_response from .namedio import common_timebase, isdtime From f591c080142177e07e3393b4d73356ef0d761d92 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 20 Nov 2022 07:27:40 +0200 Subject: [PATCH 5/5] Merge constraint constructor error tests in optimal_test --- control/tests/optimal_test.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/control/tests/optimal_test.py b/control/tests/optimal_test.py index b100e7e14..cdea19bfa 100644 --- a/control/tests/optimal_test.py +++ b/control/tests/optimal_test.py @@ -381,17 +381,8 @@ def test_optimal_logging(capsys): @pytest.mark.parametrize("fun, args, exception, match", [ [opt.quadratic_cost, (np.zeros((2, 3)), np.eye(2)), ValueError, "Q matrix is the wrong shape"], - [opt.quadratic_cost, (np.eye(2), 1), ValueError, + [opt.quadratic_cost, (np.eye(2), np.eye(2, 3)), ValueError, "R matrix is the wrong shape"], -]) -def test_constraint_constructor_errors(fun, args, exception, match): - """Test various error conditions for constraint constructors""" - sys = ct.ss2io(ct.rss(2, 2, 2)) - with pytest.raises(exception, match=match): - fun(sys, *args) - - -@pytest.mark.parametrize("fun, args, exception, match", [ [opt.input_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError, "polytope matrix must match number of inputs"], [opt.output_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy