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

Commitad6b49e

Browse files
authored
updates for NumPy 2.0 compatibility in CI tests (#1013)
1 parentd92ae6a commitad6b49e

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
returnsys.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
ifnotisinstance(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
returnself._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
importPmw
4646
importmatplotlib.pyplotasplt
4747
frommatplotlib.backends.backend_tkaggimportFigureCanvasTkAgg
48-
fromnumpy.lib.polynomialimportpolymul
49-
fromnumpy.lib.type_checkimportreal
50-
fromnumpy.core.multiarrayimportarray
51-
fromnumpy.core.fromnumericimportsize
52-
# from numpy.lib.function_base import logspace
5348
fromcontrol.matlabimportlogspace
54-
fromnumpyimportconj
49+
fromnumpyimportarray,conj,polymul,real,size
5550

5651

5752
defmake_poly(facts):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp