Skip to content

Commit ad6b49e

Browse files
authored
updates for NumPy 2.0 compatibility in CI tests (#1013)
1 parent d92ae6a commit ad6b49e

File tree

9 files changed

+16
-21
lines changed

9 files changed

+16
-21
lines changed

control/bdalg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ def negate(sys):
201201
--------
202202
>>> G = ct.tf([2], [1, 1])
203203
>>> G.dcgain()
204-
2.0
204+
np.float64(2.0)
205205
206206
>>> Gn = ct.negate(G) # Same as sys2 = -sys1.
207207
>>> Gn.dcgain()
208-
-2.0
208+
np.float64(-2.0)
209209
210210
"""
211211
return -sys

control/descfcn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,11 @@ class saturation_nonlinearity(DescribingFunctionNonlinearity):
525525
--------
526526
>>> nl = ct.saturation_nonlinearity(5)
527527
>>> nl(1)
528-
1
528+
np.int64(1)
529529
>>> nl(10)
530-
5
530+
np.int64(5)
531531
>>> nl(-10)
532-
-5
532+
np.int64(-5)
533533
534534
"""
535535
def __init__(self, ub=1, lb=None):

control/lti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def dcgain(sys):
525525
--------
526526
>>> G = ct.tf([1], [1, 2])
527527
>>> ct.dcgain(G) # doctest: +SKIP
528-
0.5
528+
np.float(0.5)
529529
530530
"""
531531
return sys.dcgain()

control/modelsimp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def hsvd(sys):
8787
>>> G = ct.tf2ss([1], [1, 2])
8888
>>> H = ct.hsvd(G)
8989
>>> H[0]
90-
0.25
90+
np.float64(0.25)
9191
9292
"""
9393
# TODO: implement for discrete time systems

control/robust.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def h2syn(P, nmeas, ncon):
7373
--------
7474
>>> # Unstable first order SISI system
7575
>>> G = ct.tf([1], [1, -1], inputs=['u'], outputs=['y'])
76-
>>> max(G.poles()) < 0 # Is G stable?
76+
>>> all(G.poles() < 0) # Is G stable?
7777
False
7878
7979
>>> # Create partitioned system with trivial unity systems
@@ -87,7 +87,7 @@ def h2syn(P, nmeas, ncon):
8787
>>> # Synthesize H2 optimal stabilizing controller
8888
>>> K = ct.h2syn(P, nmeas=1, ncon=1)
8989
>>> T = ct.feedback(G, K, sign=1)
90-
>>> max(T.poles()) < 0 # Is T stable?
90+
>>> all(T.poles() < 0) # Is T stable?
9191
True
9292
9393
"""
@@ -154,7 +154,7 @@ def hinfsyn(P, nmeas, ncon):
154154
--------
155155
>>> # Unstable first order SISI system
156156
>>> G = ct.tf([1], [1,-1], inputs=['u'], outputs=['y'])
157-
>>> max(G.poles()) < 0
157+
>>> all(G.poles() < 0)
158158
False
159159
160160
>>> # Create partitioned system with trivial unity systems
@@ -167,7 +167,7 @@ def hinfsyn(P, nmeas, ncon):
167167
>>> # Synthesize Hinf optimal stabilizing controller
168168
>>> K, CL, gam, rcond = ct.hinfsyn(P, nmeas=1, ncon=1)
169169
>>> T = ct.feedback(G, K, sign=1)
170-
>>> max(T.poles()) < 0
170+
>>> all(T.poles() < 0)
171171
True
172172
173173
"""

control/statefbk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ def ctrb(A, B, t=None):
10111011
>>> G = ct.tf2ss([1], [1, 2, 3])
10121012
>>> C = ct.ctrb(G.A, G.B)
10131013
>>> np.linalg.matrix_rank(C)
1014-
2
1014+
np.int64(2)
10151015
10161016
"""
10171017

@@ -1053,7 +1053,7 @@ def obsv(A, C, t=None):
10531053
>>> G = ct.tf2ss([1], [1, 2, 3])
10541054
>>> C = ct.obsv(G.A, G.C)
10551055
>>> np.linalg.matrix_rank(C)
1056-
2
1056+
np.int64(2)
10571057
10581058
"""
10591059

control/sysnorm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def norm(system, p=2, tol=1e-6, print_warning=True, method=None):
117117
>>> round(ct.norm(Gc, 2), 3)
118118
0.5
119119
>>> round(ct.norm(Gc, 'inf', tol=1e-5, method='scipy'), 3)
120-
1.0
120+
np.float64(1.0)
121121
"""
122122

123123
if not isinstance(system, (ct.StateSpace, ct.TransferFunction)):

control/xferfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ def dcgain(self, warn_infinite=False):
12411241
--------
12421242
>>> G = ct.tf([1], [1, 4])
12431243
>>> G.dcgain()
1244-
0.25
1244+
np.float64(0.25)
12451245
12461246
"""
12471247
return self._dcgain(warn_infinite)

examples/tfvis.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,8 @@
4545
import Pmw
4646
import matplotlib.pyplot as plt
4747
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
48-
from numpy.lib.polynomial import polymul
49-
from numpy.lib.type_check import real
50-
from numpy.core.multiarray import array
51-
from numpy.core.fromnumeric import size
52-
# from numpy.lib.function_base import logspace
5348
from control.matlab import logspace
54-
from numpy import conj
49+
from numpy import array, conj, polymul, real, size
5550

5651

5752
def make_poly(facts):

0 commit comments

Comments
 (0)
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