test_ZPK_math¶
wield.control.fitting.SISO.test.ratmath.test_ZPK_math
This is a pytest module needing documentation
Functions
|
This is a pytest needing documentation |
Details
- test_ZPK_sum(ZPK1, ZPK2)[source][github]¶
This is a pytest needing documentation
code
1@pytest.mark.parametrize("ZPK1, ZPK2", test_pairs) 2def test_ZPK_sum(ZPK1, ZPK2): 3 print("1: ", ZPK1) 4 print("2: ", ZPK2) 5 ZPK1 = ZPKTF(ZPK=ZPK1, F_nyquist_Hz=None) 6 ZPK2 = ZPKTF(ZPK=ZPK2, F_nyquist_Hz=None) 7 ZPK3 = ZPKTF( 8 ZPK=ratmath.ZPKsum( 9 ZPK1, 10 ZPK2, 11 # scale = 2 12 ), 13 F_nyquist_Hz=None 14 ) 15 print("3: ", ZPK3) 16 17 F_Hz = np.linspace(0, 100, 100) 18 TF1 = ZPK1.xfer_eval(F_Hz=F_Hz) 19 TF2 = ZPK2.xfer_eval(F_Hz=F_Hz) 20 TF3 = ZPK3.xfer_eval(F_Hz=F_Hz) 21 22 ratio = TF3 / (TF1 + TF2) 23 np.testing.assert_almost_equal(ratio, 1) 24 return
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.fitting.SISO.test.ratmath.test_ZPK_math.test_ZPK_sumThe full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.test_ZPK_sum[ZPK18-ZPK28]
output
1: ((), (-2, (-1+1j), (-1-1j)), 1) 2: (((-2+1j), (-2-1j)), ((-3+1j), (-3-1j)), 1) 3: ZPKTF(Z=rB(-2.3980425325032555, -2.1848916156311136±1.1717045925469862j, -0.616087118117254±1.28675057832388j),P=rB(-2.0, -1.0±1.0j, -3.0±1.0j),K=(1+0j))
test_ZPK_sum[ZPK16-ZPK26]
output
1: ((), (-1, -1, -1), 1) 2: ((-3,), (-2,), 1) 3: ZPKTF(Z=rB(-3.1176886328242226, -1.6414450976074124, -0.6204331347841842±0.7694800092195477j),P=rB(-2.0, -1.0, -1.0, -1.0),K=(1+0j))
test_ZPK_sum[ZPK13-ZPK23]
output
1: ((), (-2, -1, -1), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-2.465571231876768, -0.7672143840616159±0.7925519925154483j),P=rB(-2.0, -1.0, -1.0),K=(1+0j))
test_ZPK_sum[ZPK12-ZPK22]
output
1: ((), (-1, -1, -1), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-2.000000000000001, -0.5000000000000004±0.8660254037844383j),P=rB(-1.0, -1.0, -1.0),K=(1+0j))
test_ZPK_sum[ZPK10-ZPK20]
output
1: ((), (-1,), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-2.0),P=rB(-1.0),K=(1+0j))
test_ZPK_sum[ZPK17-ZPK27]
output
1: ((), (-2, -1, -1), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-2.465571231876768, -0.7672143840616159±0.7925519925154483j),P=rB(-2.0, -1.0, -1.0),K=(1+0j))
test_ZPK_sum[ZPK15-ZPK25]
output
1: ((-2, -3), (-1, -1), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-1.7499999999999996±0.6614378277661486j),P=rB(-1.0, -1.0),K=(2+0j))
test_ZPK_sum[ZPK11-ZPK21]
output
1: ((), (-1, -1), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-1.0000000000000004±0.9999999999999998j),P=rB(-1.0, -1.0),K=(1+0j))
test_ZPK_sum[ZPK14-ZPK24]
output
1: ((-3,), (-1,), 1) 2: ((), (), 1) 3: ZPKTF(Z=rB(-2.0),P=rB(-1.0),K=(2+0j))