def testFeedback(self): h1 = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) np.testing.assert_array_almost_equal( f1.feedback(1).freqresp([0.1, 1.0, 10])[0], h1.feedback(1).freqresp([0.1, 1.0, 10])[0])
def test_eval(self): sys_tf = ct.tf([1], [1, 2, 1]) frd_tf = FRD(sys_tf, np.logspace(-1, 1, 3)) np.testing.assert_almost_equal(sys_tf.evalfr(1), frd_tf.eval(1)) # Should get an error if we evaluate at an unknown frequency self.assertRaises(ValueError, frd_tf.eval, 2)
def testOperatorsTf(self): # get two SISO transfer functions h1 = TransferFunction([1], [1, 2, 2]) h2 = TransferFunction([1], [0.1, 1]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) f2 = FRD(h2, omega) f2 # reference to avoid pyflakes error np.testing.assert_array_almost_equal( (f1 + h2).frequency_response([0.1, 1.0, 10])[0], (h1 + h2).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 + h2).frequency_response([0.1, 1.0, 10])[1], (h1 + h2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 - h2).frequency_response([0.1, 1.0, 10])[0], (h1 - h2).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 - h2).frequency_response([0.1, 1.0, 10])[1], (h1 - h2).frequency_response([0.1, 1.0, 10])[1]) # multiplication and division np.testing.assert_array_almost_equal( (f1 * h2).frequency_response([0.1, 1.0, 10])[1], (h1 * h2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 / h2).frequency_response([0.1, 1.0, 10])[1], (h1 / h2).frequency_response([0.1, 1.0, 10])[1])
def testSISOtf(self): # get a SISO transfer function h = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) frd = FRD(h, omega) assert isinstance(frd, FRD) np.testing.assert_array_almost_equal( frd.freqresp([1.0]), h.freqresp([1.0]))
def testSISOtf(self): # get a SISO transfer function h = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) frd = FRD(h, omega) assert isinstance(frd, FRD) np.testing.assert_array_almost_equal(frd.freqresp([1.0]), h.freqresp([1.0]))
def test_frequency_mismatch(self): # Overlapping but non-equal frequency ranges sys1 = FRD([1, 2, 3], [4, 5, 6]) sys2 = FRD([2, 3, 4], [5, 6, 7]) self.assertRaises(NotImplementedError, FRD.__add__, sys1, sys2) # One frequency range is a subset of another sys1 = FRD([1, 2, 3], [4, 5, 6]) sys2 = FRD([2, 3], [4, 5]) self.assertRaises(NotImplementedError, FRD.__add__, sys1, sys2)
def testMIMO(self): sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]]) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) np.testing.assert_array_almost_equal( sys.frequency_response([0.1, 1.0, 10])[0], f1.frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( sys.frequency_response([0.1, 1.0, 10])[1], f1.frequency_response([0.1, 1.0, 10])[1])
def testMIMOMult(self): sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]]) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) f2 = FRD(sys, omega) np.testing.assert_array_almost_equal( (f1 * f2).freqresp([0.1, 1.0, 10])[0], (sys * sys).freqresp([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 * f2).freqresp([0.1, 1.0, 10])[1], (sys * sys).freqresp([0.1, 1.0, 10])[1])
def testFeedback(self): h1 = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) np.testing.assert_array_almost_equal( f1.feedback(1).frequency_response([0.1, 1.0, 10])[0], h1.feedback(1).frequency_response([0.1, 1.0, 10])[0]) # Make sure default argument also works np.testing.assert_array_almost_equal( f1.feedback().frequency_response([0.1, 1.0, 10])[0], h1.feedback().frequency_response([0.1, 1.0, 10])[0])
def testSISOtf(self): # get a SISO transfer function h = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) frd = FRD(h, omega) assert isinstance(frd, FRD) mag1, phase1, omega1 = frd.frequency_response([1.0]) mag2, phase2, omega2 = h.frequency_response([1.0]) np.testing.assert_array_almost_equal(mag1, mag2) np.testing.assert_array_almost_equal(phase1, phase2) np.testing.assert_array_almost_equal(omega1, omega2)
def test_to_pandas(): # Create a SISO frequency response h1 = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) resp = FRD(h1, omega) # Convert to pandas df = resp.to_pandas() # Check to make sure the data make senses np.testing.assert_equal(df['omega'], resp.omega) np.testing.assert_equal(df['H_{y[0], u[0]}'], resp.fresp[0, 0])
def testAgainstOctave(self): # with data from octave: #sys = ss([-2 0 0; 0 -1 1; 0 0 -3], [1 0; 0 0; 0 1], eye(3), zeros(3,2)) #bfr = frd(bsys, [1]) sys = StateSpace(np.matrix('-2.0 0 0; 0 -1 1; 0 0 -3'), np.matrix('1.0 0; 0 0; 0 1'), np.eye(3), np.zeros((3,2))) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) np.testing.assert_array_almost_equal( (f1.freqresp([1.0])[0] * np.exp(1j*f1.freqresp([1.0])[1])).reshape(3,2), np.matrix('0.4-0.2j 0; 0 0.1-0.2j; 0 0.3-0.1j'))
def testMIMO(self): sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]]) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) np.testing.assert_array_almost_equal( sys.freqresp([0.1, 1.0, 10])[0], f1.freqresp([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( sys.freqresp([0.1, 1.0, 10])[1], f1.freqresp([0.1, 1.0, 10])[1])
def testAgainstOctave(self): # with data from octave: #sys = ss([-2 0 0; 0 -1 1; 0 0 -3], [1 0; 0 0; 0 1], eye(3), zeros(3,2)) #bfr = frd(bsys, [1]) sys = StateSpace(np.matrix('-2.0 0 0; 0 -1 1; 0 0 -3'), np.matrix('1.0 0; 0 0; 0 1'), np.eye(3), np.zeros((3, 2))) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) np.testing.assert_array_almost_equal( (f1.freqresp([1.0])[0] * np.exp(1j * f1.freqresp([1.0])[1])).reshape(3, 2), np.matrix('0.4-0.2j 0; 0 0.1-0.2j; 0 0.3-0.1j'))
def testAgainstOctave(self): # with data from octave: # sys = ss([-2 0 0; 0 -1 1; 0 0 -3], # [1 0; 0 0; 0 1], eye(3), zeros(3,2)) # bfr = frd(bsys, [1]) sys = StateSpace(np.array([[-2.0, 0, 0], [0, -1, 1], [0, 0, -3]]), np.array([[1.0, 0], [0, 0], [0, 1]]), np.eye(3), np.zeros((3, 2))) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega) np.testing.assert_array_almost_equal( (f1.frequency_response([1.0])[0] * np.exp(1j * f1.frequency_response([1.0])[1])).reshape(3, 2), np.array([[0.4 - 0.2j, 0], [0, 0.1 - 0.2j], [0, 0.3 - 0.1j]]))
def test_frd(self): f = np.array([ 0.005, 0.010, 0.020, 0.030, 0.040, 0.050, 0.060, 0.070, 0.080, 0.090, 0.100, 0.200, 0.300, 0.400, 0.500, 0.750, 1.000, 1.250, 1.500, 1.750, 2.000, 2.250, 2.500, 2.750, 3.000, 3.250, 3.500, 3.750, 4.000, 4.250, 4.500, 4.750, 5.000, 6.000, 7.000, 8.000, 9.000, 10.000 ]) gain = np.array([ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.2, 0.3, 0.5, 0.5, -0.4, -2.3, -4.8, -7.3, -9.6, -11.7, -13.6, -15.3, -16.9, -18.3, -19.6, -20.8, -22.0, -23.1, -24.1, -25.0, -25.9, -29.1, -31.9, -34.2, -36.2, -38.1 ]) phase = np.array([ 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -19, -29, -40, -51, -81, -114, -144, -168, -187, -202, -214, -224, -233, -240, -247, -253, -259, -264, -269, -273, -277, -280, -292, -301, -307, -313, -317 ]) # calculate response as complex number resp = 10**(gain / 20) * np.exp(1j * phase / (180. / np.pi)) # frequency response data fresp = FRD(resp, f * 2 * np.pi, smooth=True) s = TransferFunction([1, 0], [1]) G = 1. / (s**2) K = 1. C = K * (1 + 1.9 * s) TFopen = fresp * C * G gm, pm, sm, wg, wp, ws = stability_margins(TFopen) assert_array_almost_equal([pm], [44.55], 2)
def test_size_mismatch(self): sys1 = FRD(ct.rss(2, 2, 2), np.logspace(-1, 1, 10)) # Different number of inputs sys2 = FRD(ct.rss(3, 1, 2), np.logspace(-1, 1, 10)) self.assertRaises(ValueError, FRD.__add__, sys1, sys2) # Different number of outputs sys2 = FRD(ct.rss(3, 2, 1), np.logspace(-1, 1, 10)) self.assertRaises(ValueError, FRD.__add__, sys1, sys2) # Inputs and outputs don't match self.assertRaises(ValueError, FRD.__mul__, sys2, sys1) # Feedback mismatch self.assertRaises(ValueError, FRD.feedback, sys2, sys1)
def frd(*args): ''' Construct a Frequency Response Data model, or convert a system frd models store the (measured) frequency response of a system. This function can be called in different ways: ``frd(response, freqs)`` Create an frd model with the given response data, in the form of complex response vector, at matching frequency freqs [in rad/s] ``frd(sys, freqs)`` Convert an Lti system into an frd model with data at frequencies freqs. Parameters ---------- response: array_like, or list complex vector with the system response freq: array_lik or lis vector with frequencies sys: Lti (StateSpace or TransferFunction) A linear system Returns ------- sys: FRD New frequency response system See Also -------- ss, tf ''' return FRD(*args)
def testMIMOSmooth(self): sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]], [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]) sys2 = np.array([[1, 0, 0], [0, 1, 0]]) * sys omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega, smooth=True) f2 = FRD(sys2, omega, smooth=True) np.testing.assert_array_almost_equal( (f1 * f2).frequency_response([0.1, 1.0, 10])[0], (sys * sys2).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 * f2).frequency_response([0.1, 1.0, 10])[1], (sys * sys2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 * f2).frequency_response([0.1, 1.0, 10])[2], (sys * sys2).frequency_response([0.1, 1.0, 10])[2])
def testNyquist(self): h1 = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 40) f1 = FRD(h1, omega, smooth=True) freqplot.nyquist(f1, np.logspace(-1, 2, 100)) # plt.savefig('/dev/null', format='svg') plt.figure(2) freqplot.nyquist(f1, f1.omega)
def test_nocross(self): # what happens when no gain/phase crossover? s = TransferFunction([1, 0], [1]) h1 = 1 / (1 + s) h2 = 3 * (10 + s) / (2 + s) h3 = 0.01 * (10 - s) / (2 + s) / (1 + s) gm, pm, wm, wg, wp, ws = stability_margins(h1) self.assertEqual(gm, None) self.assertEqual(wg, None) gm, pm, wm, wg, wp, ws = stability_margins(h2) self.assertEqual(pm, None) gm, pm, wm, wg, wp, ws = stability_margins(h3) self.assertEqual(pm, None) omega = np.logspace(-2, 2, 100) out1b = stability_margins(FRD(h1, omega)) out2b = stability_margins(FRD(h2, omega)) out3b = stability_margins(FRD(h3, omega))
def testMIMOfb(self): sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]]) omega = np.logspace(-1, 2, 10) f1 = FRD(sys, omega).feedback([[0.1, 0.3], [0.0, 1.0]]) f2 = FRD(sys.feedback([[0.1, 0.3], [0.0, 1.0]]), omega) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[0], f2.freqresp([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[1], f2.freqresp([0.1, 1.0, 10])[1])
def testOperators(self): # get two SISO transfer functions h1 = TransferFunction([1], [1, 2, 2]) h2 = TransferFunction([1], [0.1, 1]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) f2 = FRD(h2, omega) np.testing.assert_array_almost_equal( (f1 + f2).frequency_response([0.1, 1.0, 10])[0], (h1 + h2).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 + f2).frequency_response([0.1, 1.0, 10])[1], (h1 + h2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 - f2).frequency_response([0.1, 1.0, 10])[0], (h1 - h2).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (f1 - f2).frequency_response([0.1, 1.0, 10])[1], (h1 - h2).frequency_response([0.1, 1.0, 10])[1]) # multiplication and division np.testing.assert_array_almost_equal( (f1 * f2).frequency_response([0.1, 1.0, 10])[1], (h1 * h2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 / f2).frequency_response([0.1, 1.0, 10])[1], (h1 / h2).frequency_response([0.1, 1.0, 10])[1]) # with default conversion from scalar np.testing.assert_array_almost_equal( (f1 * 1.5).frequency_response([0.1, 1.0, 10])[1], (h1 * 1.5).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (f1 / 1.7).frequency_response([0.1, 1.0, 10])[1], (h1 / 1.7).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (2.2 * f2).frequency_response([0.1, 1.0, 10])[1], (2.2 * h2).frequency_response([0.1, 1.0, 10])[1]) np.testing.assert_array_almost_equal( (1.3 / f2).frequency_response([0.1, 1.0, 10])[1], (1.3 / h2).frequency_response([0.1, 1.0, 10])[1])
def test_frequency_mismatch(self, recwarn): # recwarn: there may be a warning before the error! # Overlapping but non-equal frequency ranges sys1 = FRD([1, 2, 3], [4, 5, 6]) sys2 = FRD([2, 3, 4], [5, 6, 7]) with pytest.raises(NotImplementedError): FRD.__add__(sys1, sys2) # One frequency range is a subset of another sys1 = FRD([1, 2, 3], [4, 5, 6]) sys2 = FRD([2, 3], [4, 5]) with pytest.raises(NotImplementedError): FRD.__add__(sys1, sys2)
def test_nocross(self): # what happens when no gain/phase crossover? s = TransferFunction([1, 0], [1]) h1 = 1 / (1 + s) h2 = 3 * (10 + s) / (2 + s) h3 = 0.01 * (10 - s) / (2 + s) / (1 + s) gm, pm, wm, wg, wp, ws = stability_margins(h1) assert_array_almost_equal( [gm, pm, wg, wp], [float('Inf'), float('Inf'), float('NaN'), float('NaN')]) gm, pm, wm, wg, wp, ws = stability_margins(h2) self.assertEqual(pm, float('Inf')) gm, pm, wm, wg, wp, ws = stability_margins(h3) self.assertTrue(np.isnan(wp)) omega = np.logspace(-2, 2, 100) out1b = stability_margins(FRD(h1, omega)) out2b = stability_margins(FRD(h2, omega)) out3b = stability_margins(FRD(h3, omega))
def testMIMOfb2(self): sys = StateSpace(np.array([[-2.0, 0, 0], [0, -1, 1], [0, 0, -3]]), np.array([[1.0, 0], [0, 0], [0, 1]]), np.eye(3), np.zeros((3, 2))) omega = np.logspace(-1, 2, 10) K = np.array([[1, 0.3, 0], [0.1, 0, 0]]) f1 = FRD(sys, omega).feedback(K) f2 = FRD(sys.feedback(K), omega) np.testing.assert_array_almost_equal( f1.frequency_response([0.1, 1.0, 10])[0], f2.frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( f1.frequency_response([0.1, 1.0, 10])[1], f2.frequency_response([0.1, 1.0, 10])[1])
def testMIMOfb2(self): sys = StateSpace(np.matrix('-2.0 0 0; 0 -1 1; 0 0 -3'), np.matrix('1.0 0; 0 0; 0 1'), np.eye(3), np.zeros((3, 2))) omega = np.logspace(-1, 2, 10) K = np.matrix('1 0.3 0; 0.1 0 0') f1 = FRD(sys, omega).feedback(K) f2 = FRD(sys.feedback(K), omega) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[0], f2.freqresp([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[1], f2.freqresp([0.1, 1.0, 10])[1])
def test_stability_margins(self): omega = np.logspace(-2, 2, 2000) for sys, rgm, rwgm, rpm, rwpm in self.tsys: print(sys) out = np.array(stability_margins(sys)) gm, pm, sm, wg, wp, ws = out outf = np.array(stability_margins(FRD(sys, omega))) print(out, '\n', outf) #print(out != np.array(None)) assert_array_almost_equal(out, outf, 2) # final one with fixed values assert_array_almost_equal([gm, pm, sm, wg, wp, ws], self.stability_margins4, 3)
def test_named_signals(): ct.namedio.NamedIOSystem._idCounter = 0 h1 = TransferFunction([1], [1, 2, 2]) h2 = TransferFunction([1], [0.1, 1]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) f2 = FRD(h2, omega) # Make sure that systems were properly named assert f1.name == 'sys[2]' assert f2.name == 'sys[3]' assert f1.ninputs == 1 assert f1.input_labels == ['u[0]'] assert f1.noutputs == 1 assert f1.output_labels == ['y[0]'] # Change names f1 = FRD(h1, omega, name='mysys', inputs='u0', outputs='y0') assert f1.name == 'mysys' assert f1.ninputs == 1 assert f1.input_labels == ['u0'] assert f1.noutputs == 1 assert f1.output_labels == ['y0']
def testbdalg(self): # get two SISO transfer functions h1 = TransferFunction([1], [1, 2, 2]) h2 = TransferFunction([1], [0.1, 1]) omega = np.logspace(-1, 2, 10) f1 = FRD(h1, omega) f2 = FRD(h2, omega) np.testing.assert_array_almost_equal( (bdalg.series(f1, f2)).frequency_response([0.1, 1.0, 10])[0], (bdalg.series(h1, h2)).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (bdalg.parallel(f1, f2)).frequency_response([0.1, 1.0, 10])[0], (bdalg.parallel(h1, h2)).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (bdalg.feedback(f1, f2)).frequency_response([0.1, 1.0, 10])[0], (bdalg.feedback(h1, h2)).frequency_response([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( (bdalg.negate(f1)).frequency_response([0.1, 1.0, 10])[0], (bdalg.negate(h1)).frequency_response([0.1, 1.0, 10])[0])
def test_eval(self): sys_tf = ct.tf([1], [1, 2, 1]) frd_tf = FRD(sys_tf, np.logspace(-1, 1, 3)) np.testing.assert_almost_equal(sys_tf(1j), frd_tf.eval(1)) np.testing.assert_almost_equal(sys_tf(1j), frd_tf(1j)) # Should get an error if we evaluate at an unknown frequency with pytest.raises(ValueError, match="not .* in frequency list"): frd_tf.eval(2) # Should get an error if we evaluate at an complex number with pytest.raises(ValueError, match="can only accept real-valued"): frd_tf.eval(2 + 1j) # Should get an error if we use __call__ at real-valued frequency with pytest.raises(ValueError, match="only accept purely imaginary"): frd_tf(2)
def testMIMOfb2(self): sys = StateSpace(np.matrix('-2.0 0 0; 0 -1 1; 0 0 -3'), np.matrix('1.0 0; 0 0; 0 1'), np.eye(3), np.zeros((3,2))) omega = np.logspace(-1, 2, 10) K = np.matrix('1 0.3 0; 0.1 0 0') f1 = FRD(sys, omega).feedback(K) f2 = FRD(sys.feedback(K), omega) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[0], f2.freqresp([0.1, 1.0, 10])[0]) np.testing.assert_array_almost_equal( f1.freqresp([0.1, 1.0, 10])[1], f2.freqresp([0.1, 1.0, 10])[1])
def test_evalfr_deprecated(self): sys_tf = ct.tf([1], [1, 2, 1]) frd_tf = FRD(sys_tf, np.logspace(-1, 1, 3)) # Deprecated version of the call (should generate warning) import warnings with warnings.catch_warnings(): # Make warnings generate an exception warnings.simplefilter('error') # Make sure that we get a pending deprecation warning self.assertRaises(PendingDeprecationWarning, frd_tf.evalfr, 1.) # FRD.evalfr() is being deprecated import warnings with warnings.catch_warnings(): # Make warnings generate an exception warnings.simplefilter('error') # Make sure that we get a pending deprecation warning self.assertRaises(PendingDeprecationWarning, frd_tf.evalfr, 1.)
def test_unrecognized_keyword(self): h = TransferFunction([1], [1, 2, 2]) omega = np.logspace(-1, 2, 10) with pytest.raises(TypeError, match="unrecognized keyword"): frd = FRD(h, omega, unknown=None)
def test_freqresp_deprecated(self): sys_tf = ct.tf([1], [1, 2, 1]) frd_tf = FRD(sys_tf, np.logspace(-1, 1, 3)) with pytest.warns(DeprecationWarning): frd_tf.freqresp(1.)