From eaafa979aa0ed0c660e8e515e746fa880985580a Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Wed, 26 Jun 2024 06:29:48 -0700 Subject: [PATCH] updates for NumPy 2.0 compatibility in CI tests --- control/bdalg.py | 4 ++-- control/descfcn.py | 6 +++--- control/lti.py | 2 +- control/modelsimp.py | 2 +- control/robust.py | 8 ++++---- control/statefbk.py | 4 ++-- control/sysnorm.py | 2 +- control/xferfcn.py | 2 +- examples/tfvis.py | 7 +------ 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/control/bdalg.py b/control/bdalg.py index 6ab9cd9ca..63cd9354d 100644 --- a/control/bdalg.py +++ b/control/bdalg.py @@ -201,11 +201,11 @@ def negate(sys): -------- >>> G = ct.tf([2], [1, 1]) >>> G.dcgain() - 2.0 + np.float64(2.0) >>> Gn = ct.negate(G) # Same as sys2 = -sys1. >>> Gn.dcgain() - -2.0 + np.float64(-2.0) """ return -sys diff --git a/control/descfcn.py b/control/descfcn.py index 6586e6f20..f52b43a2c 100644 --- a/control/descfcn.py +++ b/control/descfcn.py @@ -525,11 +525,11 @@ class saturation_nonlinearity(DescribingFunctionNonlinearity): -------- >>> nl = ct.saturation_nonlinearity(5) >>> nl(1) - 1 + np.int64(1) >>> nl(10) - 5 + np.int64(5) >>> nl(-10) - -5 + np.int64(-5) """ def __init__(self, ub=1, lb=None): diff --git a/control/lti.py b/control/lti.py index e631a6213..65a500121 100644 --- a/control/lti.py +++ b/control/lti.py @@ -525,7 +525,7 @@ def dcgain(sys): -------- >>> G = ct.tf([1], [1, 2]) >>> ct.dcgain(G) # doctest: +SKIP - 0.5 + np.float(0.5) """ return sys.dcgain() diff --git a/control/modelsimp.py b/control/modelsimp.py index cbaf242c3..06c3d350d 100644 --- a/control/modelsimp.py +++ b/control/modelsimp.py @@ -87,7 +87,7 @@ def hsvd(sys): >>> G = ct.tf2ss([1], [1, 2]) >>> H = ct.hsvd(G) >>> H[0] - 0.25 + np.float64(0.25) """ # TODO: implement for discrete time systems diff --git a/control/robust.py b/control/robust.py index 75930e59e..d5e5540fb 100644 --- a/control/robust.py +++ b/control/robust.py @@ -73,7 +73,7 @@ def h2syn(P, nmeas, ncon): -------- >>> # Unstable first order SISI system >>> G = ct.tf([1], [1, -1], inputs=['u'], outputs=['y']) - >>> max(G.poles()) < 0 # Is G stable? + >>> all(G.poles() < 0) # Is G stable? False >>> # Create partitioned system with trivial unity systems @@ -87,7 +87,7 @@ def h2syn(P, nmeas, ncon): >>> # Synthesize H2 optimal stabilizing controller >>> K = ct.h2syn(P, nmeas=1, ncon=1) >>> T = ct.feedback(G, K, sign=1) - >>> max(T.poles()) < 0 # Is T stable? + >>> all(T.poles() < 0) # Is T stable? True """ @@ -154,7 +154,7 @@ def hinfsyn(P, nmeas, ncon): -------- >>> # Unstable first order SISI system >>> G = ct.tf([1], [1,-1], inputs=['u'], outputs=['y']) - >>> max(G.poles()) < 0 + >>> all(G.poles() < 0) False >>> # Create partitioned system with trivial unity systems @@ -167,7 +167,7 @@ def hinfsyn(P, nmeas, ncon): >>> # Synthesize Hinf optimal stabilizing controller >>> K, CL, gam, rcond = ct.hinfsyn(P, nmeas=1, ncon=1) >>> T = ct.feedback(G, K, sign=1) - >>> max(T.poles()) < 0 + >>> all(T.poles() < 0) True """ diff --git a/control/statefbk.py b/control/statefbk.py index 19fec5d29..a385516ee 100644 --- a/control/statefbk.py +++ b/control/statefbk.py @@ -1011,7 +1011,7 @@ def ctrb(A, B, t=None): >>> G = ct.tf2ss([1], [1, 2, 3]) >>> C = ct.ctrb(G.A, G.B) >>> np.linalg.matrix_rank(C) - 2 + np.int64(2) """ @@ -1053,7 +1053,7 @@ def obsv(A, C, t=None): >>> G = ct.tf2ss([1], [1, 2, 3]) >>> C = ct.obsv(G.A, G.C) >>> np.linalg.matrix_rank(C) - 2 + np.int64(2) """ diff --git a/control/sysnorm.py b/control/sysnorm.py index f5e583dcf..6737dc5c0 100644 --- a/control/sysnorm.py +++ b/control/sysnorm.py @@ -117,7 +117,7 @@ def norm(system, p=2, tol=1e-6, print_warning=True, method=None): >>> round(ct.norm(Gc, 2), 3) 0.5 >>> round(ct.norm(Gc, 'inf', tol=1e-5, method='scipy'), 3) - 1.0 + np.float64(1.0) """ if not isinstance(system, (ct.StateSpace, ct.TransferFunction)): diff --git a/control/xferfcn.py b/control/xferfcn.py index de38a4a30..63aeff8f9 100644 --- a/control/xferfcn.py +++ b/control/xferfcn.py @@ -1241,7 +1241,7 @@ def dcgain(self, warn_infinite=False): -------- >>> G = ct.tf([1], [1, 4]) >>> G.dcgain() - 0.25 + np.float64(0.25) """ return self._dcgain(warn_infinite) diff --git a/examples/tfvis.py b/examples/tfvis.py index 0cb789db4..c9e9872de 100644 --- a/examples/tfvis.py +++ b/examples/tfvis.py @@ -45,13 +45,8 @@ import Pmw import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg -from numpy.lib.polynomial import polymul -from numpy.lib.type_check import real -from numpy.core.multiarray import array -from numpy.core.fromnumeric import size -# from numpy.lib.function_base import logspace from control.matlab import logspace -from numpy import conj +from numpy import array, conj, polymul, real, size def make_poly(facts): 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