Skip to content

Updates for NumPy 2.0 compatibility in CI tests #1013

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions control/bdalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions control/descfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion control/lti.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions control/robust.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

"""
Expand Down Expand Up @@ -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
Expand All @@ -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

"""
Expand Down
4 changes: 2 additions & 2 deletions control/statefbk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

"""

Expand Down Expand Up @@ -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)

"""

Expand Down
2 changes: 1 addition & 1 deletion control/sysnorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand Down
2 changes: 1 addition & 1 deletion control/xferfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions examples/tfvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading