Skip to content

Commit 87d48ab

Browse files
committed
TST:
- added a test that generates a plot
1 parent 65b4e49 commit 87d48ab

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

control/tests/freqresp_test.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def test_dcgain_consistency():
511511
np.testing.assert_almost_equal(sys_ss.dcgain(), -1)
512512

513513

514-
# Testing of the singular_value_plot_function
514+
# Testing of the singular_value_plot function
515515
class TSys:
516516
"""Struct of test system"""
517517
def __init__(self, sys=None, call_kwargs=None):
@@ -593,6 +593,7 @@ def ss_mimo_dt():
593593
[1.39141936, 1.38752248, 1.11314018]])]
594594
return T
595595

596+
596597
@pytest.fixture
597598
def tsystem(request, ss_mimo_ct, ss_miso_ct, ss_simo_ct, ss_siso_ct, ss_mimo_dt):
598599

@@ -612,3 +613,20 @@ def test_singular_values_plot(tsystem):
612613
for omega_ref, sigma_ref in zip(tsystem.omegas, tsystem.sigmas):
613614
sigma, _ = singular_values_plot(sys, omega_ref, plot=False)
614615
np.testing.assert_almost_equal(sigma, sigma_ref)
616+
617+
618+
def test_singular_values_plot_mpl(ss_mimo_ct):
619+
sys = ss_mimo_ct.sys
620+
plt.figure()
621+
omega_all = np.logspace(-3, 2, 1000)
622+
singular_values_plot(sys, omega_all, plot=True)
623+
fig = plt.gcf()
624+
allaxes = fig.get_axes()
625+
assert(len(allaxes) == 1)
626+
assert(allaxes[0].get_label() == 'control-sigma')
627+
plt.figure()
628+
singular_values_plot(sys, plot=True, Hz=True, dB=True, grid=False) # non-default settings
629+
fig = plt.gcf()
630+
allaxes = fig.get_axes()
631+
assert(len(allaxes) == 1)
632+
assert(allaxes[0].get_label() == 'control-sigma')

0 commit comments

Comments
 (0)