Skip to content

Commit 8808fe9

Browse files
authored
Merge pull request python-control#1243 from murrayrm
Fix CI test and doctest failures with updated NumPy, SciPy, and Matplotlib python-control#1243
2 parents e60e5eb + 65d1d26 commit 8808fe9

8 files changed

Lines changed: 14 additions & 15 deletions

File tree

‎control/descfcn.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ def describing_function(
188188

189189
# Go through all of the amplitudes we were given
190190
retdf = np.empty(np.shape(A), dtype=complex)
191-
df = retdf # Access to the return array
192-
df.shape = (-1, ) # as a 1D array
191+
df = retdf.reshape((-1, )) # Access to the return array as a 1D array
193192
for i, a in enumerate(np.atleast_1d(A)):
194193
# Make sure we got a valid argument
195194
if a == 0:

‎control/lti.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,15 @@ def bandwidth(sys, dbdrop=-3):
706706
Examples
707707
--------
708708
>>> G = ct.tf([1], [1, 1])
709-
>>> ct.bandwidth(G)
710-
np.float64(0.9976283451102316)
709+
>>> ct.bandwidth(G) # doctest: +ELLIPSIS
710+
np.float64(0.99762834511023...)
711711
712712
>>> G1 = ct.tf(0.1, [1, 0.1])
713713
>>> wn2 = 1
714714
>>> zeta2 = 0.001
715715
>>> G2 = ct.tf(wn2**2, [1, 2*zeta2*wn2, wn2**2])
716-
>>> ct.bandwidth(G1*G2)
717-
np.float64(0.10184838823897456)
716+
>>> ct.bandwidth(G1*G2) # doctest: +ELLIPSIS
717+
np.float64(0.10184838823897...)
718718
719719
"""
720720
if not isinstance(sys, LTI):

‎control/modelsimp.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def hankel_singular_values(sys):
7373
WoWc = Wo @ Wc
7474
w, v = np.linalg.eig(WoWc)
7575

76-
hsv = np.sqrt(w)
76+
hsv = np.sqrt(w.real)
7777
hsv = np.array(hsv)
7878
hsv = np.sort(hsv)
7979
# Return the Hankel singular values, high to low

‎control/phaseplot.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ def separatrices(
892892
timepts = np.linspace(0, timescale)
893893

894894
# Run the trajectory starting in eigenvector directions
895+
dir = dir.real # use real components only
895896
for eps in [-radius, radius]:
896897
x0 = xeq + dir * eps
897898
if evals[j].real < 0:

‎control/statesp.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ def __init__(self, *args, **kwargs):
261261

262262
# Reset shapes if the system is static
263263
if static:
264-
A.shape = (0, 0)
265-
B.shape = (0, self.ninputs)
266-
C.shape = (self.noutputs, 0)
264+
A = A.reshape((0, 0))
265+
B = B.reshape((0, self.ninputs))
266+
C = C.reshape((self.noutputs, 0))
267267

268268
# Check to make sure everything is consistent
269269
_check_shape(A, self.nstates, self.nstates, name="A")

‎control/tests/ctrlplot_test.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,7 @@ def test_pole_zero_subplots(savefig=False):
748748
sys2 = ct.tf([1, 0.2], [1, 1, 3, 1, 1], name='sys2')
749749
ct.root_locus_plot([sys1, sys2], ax=ax_array[0, 0])
750750
cplt = ct.root_locus_plot([sys1, sys2], ax=ax_array[1, 0])
751-
with pytest.warns(UserWarning, match="Tight layout not applied"):
752-
cplt.set_plot_title("Root locus plots (w/ specified axes)")
751+
cplt.set_plot_title("Root locus plots (w/ specified axes)")
753752
if savefig:
754753
plt.savefig("ctrlplot-pole_zero_subplots.png")
755754

‎control/tests/nyquist_test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def test_nyquist_indent_im():
374374

375375
def test_nyquist_indent_near_imaginary_axis():
376376
"""Test indent direction for poles near the imaginary axis."""
377-
sys = ct.tf([1, 11, 10], [0.01, 1, 0.01, 1])
377+
sys = ct.zpk([-10, -1], [-100, 0.001+1j, 0.001-1j], 10)
378378
omega = np.linspace(0, 2, 21)
379379

380380
_, contour_default = ct.nyquist_response(

‎doc/intro.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,5 @@ This documentation has a number of notional conventions and functionality:
190190
.. doctest::
191191

192192
>>> sys = ct.tf([1], [1, 0.5, 1])
193-
>>> ct.bandwidth(sys)
194-
np.float64(1.4839084518312828)
193+
>>> ct.bandwidth(sys) # doctest: +ELLIPSIS
194+
np.float64(1.4839084518312...)

0 commit comments

Comments
 (0)