test_SS_models¶
wield.control.algorithms.statespace.dense.test.test_SS_models
This is a pytest module needing documentation
Functions
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
|
This is a pytest needing documentation |
Details
- print_ssd(ssd)[source][github]¶
This is a pytest needing documentation
code
1def print_ssd(ssd): 2 print("B", ssd.B) 3 print("A", ssd.A) 4 print("E", ssd.E) 5 print("C", ssd.C) 6 print("D", ssd.D)
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.algorithms.statespace.dense.test.test_SS_models.print_ssdThe 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.
- settest(test_trigger, plot, Zc, Zr, Pc, Pr, k)[source][github]¶
This is a pytest needing documentation
code
1def settest(test_trigger, plot, Zc, Zr, Pc, Pr, k): 2 Zc = 2 * np.pi * np.asarray(Zc) 3 Zr = 2 * np.pi * np.asarray(Zr) 4 Pc = 2 * np.pi * np.asarray(Pc) 5 Pr = 2 * np.pi * np.asarray(Pr) 6 7 Z = np.concatenate([Zc, Zc.conjugate(), Zr]) 8 P = np.concatenate([Pc, Pc.conjugate(), Pr]) 9 10 sys1 = zpk_algorithms.ZPKdict( 11 zdict=dict(c=Zc, r=Zr), 12 pdict=dict(c=Pc, r=Pr), 13 k=k, 14 ) 15 print_ssd(sys1) 16 17 F_Hz = logspaced(0.01, 1e3, 1000) 18 xfer = xfer_algorithms.ss2xfer(*sys1, F_Hz=F_Hz) 19 20 # TODO, use IIRrational version since statespace is likely more numerically 21 # stable than crappy scipy implementation 22 w, xfer2 = scipy.signal.freqs_zpk(Z, P, k, 2 * np.pi * F_Hz) 23 24 def trigger(fail, plot): 25 axB = mplfigB(Nrows=2) 26 axB.ax0.loglog(F_Hz, abs(xfer)) 27 axB.ax1.semilogx(F_Hz, np.angle(xfer, deg=True)) 28 axB.ax0.loglog(F_Hz, abs(xfer2)) 29 axB.ax1.semilogx(F_Hz, np.angle(xfer2, deg=True)) 30 axB.save(tjoin("test")) 31 32 with test_trigger(trigger, plot=plot): 33 np.testing.assert_almost_equal(xfer, xfer2, decimal=5) 34 35 sys_inv = ss_algorithms.inverse_DSS(*sys1) 36 xfer = 1 / xfer_algorithms.ss2xfer(*sys_inv, F_Hz=F_Hz) 37 38 def trigger(fail, plot): 39 axB = mplfigB(Nrows=2) 40 axB.ax0.loglog(F_Hz, abs(xfer)) 41 axB.ax1.semilogx(F_Hz, np.angle(xfer, deg=True)) 42 axB.ax0.loglog(F_Hz, abs(xfer2)) 43 axB.ax1.semilogx(F_Hz, np.angle(xfer2, deg=True)) 44 axB.save(tjoin("test_inv")) 45 46 with test_trigger(trigger, plot=plot): 47 np.testing.assert_almost_equal(xfer, xfer2, decimal=5)
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.algorithms.statespace.dense.test.test_SS_models.settestThe 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_xfers(test_trigger, tpath_preclear, plot)[source][github]¶
This is a pytest needing documentation
code
1def test_xfers(test_trigger, tpath_preclear, plot): 2 settest( 3 test_trigger, 4 tjoin, 5 plot, 6 Zc=[-1 + 1j, -1 + 5j], 7 Zr=[-100, -200], 8 Pc=[-1 + 2j, -1 + 6j], 9 Pr=[-10, -20], 10 # Zc = 2 * np.pi * np.asarray([]) 11 # Pc = 2 * np.pi * np.asarray([]) 12 k=1, 13 )
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.algorithms.statespace.dense.test.test_SS_models.test_xfersThe 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_xfers
output
status: failed duration: 0.000s captured errors: test_trigger = <function test_trigger.<locals>.fail at 0x7f52b1787ba0> tpath_preclear = None, plot = False def test_xfers(test_trigger, tpath_preclear, plot): > settest( test_trigger, tjoin, plot, Zc=[-1 + 1j, -1 + 5j], Zr=[-100, -200], Pc=[-1 + 2j, -1 + 6j], Pr=[-10, -20], # Zc = 2 * np.pi * np.asarray([]) # Pc = 2 * np.pi * np.asarray([]) k=1, ) E TypeError: settest() got multiple values for argument 'Zc' ../../src/wield/control/algorithms/statespace/dense/test/test_SS_models.py:92: TypeError
- test_xfers12(test_trigger, tpath_preclear, plot)[source][github]¶
This is a pytest needing documentation
code
1def test_xfers12(test_trigger, tpath_preclear, plot): 2 settest(test_trigger, tjoin, plot, Zc=[], Zr=[-100], Pc=[-1 + 2j], Pr=[], k=1)
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.algorithms.statespace.dense.test.test_SS_models.test_xfers12The 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_xfers12
output
status: failed duration: 0.000s captured errors: test_trigger = <function test_trigger.<locals>.fail at 0x7f52b15b1440> tpath_preclear = None, plot = False def test_xfers12(test_trigger, tpath_preclear, plot): > settest(test_trigger, tjoin, plot, Zc=[], Zr=[-100], Pc=[-1 + 2j], Pr=[], k=1) E TypeError: settest() got multiple values for argument 'Zc' ../../src/wield/control/algorithms/statespace/dense/test/test_SS_models.py:120: TypeError
- test_xfers2(test_trigger, tpath_preclear, plot)[source][github]¶
This is a pytest needing documentation
code
1def test_xfers2(test_trigger, tpath_preclear, plot): 2 settest( 3 test_trigger, 4 tjoin, 5 plot, 6 Zc=[-1 + 1j, -1 + 5j], 7 Zr=[-100, -200], 8 Pc=[-1 + 2j, -1 + 6j], 9 Pr=[-10, -20, -30], 10 k=1, 11 )
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.algorithms.statespace.dense.test.test_SS_models.test_xfers2The 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_xfers2
output
status: failed duration: 0.000s captured errors: test_trigger = <function test_trigger.<locals>.fail at 0x7f52b15b13a0> tpath_preclear = None, plot = False def test_xfers2(test_trigger, tpath_preclear, plot): > settest( test_trigger, tjoin, plot, Zc=[-1 + 1j, -1 + 5j], Zr=[-100, -200], Pc=[-1 + 2j, -1 + 6j], Pr=[-10, -20, -30], k=1, ) E TypeError: settest() got multiple values for argument 'Zc' ../../src/wield/control/algorithms/statespace/dense/test/test_SS_models.py:107: TypeError
- test_xfers22(test_trigger, tpath_preclear, plot)[source][github]¶
This is a pytest needing documentation
code
1def test_xfers22(test_trigger, tpath_preclear, plot): 2 settest( 3 test_trigger, tjoin, plot, Zc=[], Zr=[-10, -10], Pc=[-1 + 2j], Pr=[], k=1 4 )
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.algorithms.statespace.dense.test.test_SS_models.test_xfers22The 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_xfers22
output
status: failed duration: 0.000s captured errors: test_trigger = <function test_trigger.<locals>.fail at 0x7f52b15b1760> tpath_preclear = None, plot = False def test_xfers22(test_trigger, tpath_preclear, plot): > settest( test_trigger, tjoin, plot, Zc=[], Zr=[-10, -10], Pc=[-1 + 2j], Pr=[], k=1 ) E TypeError: settest() got multiple values for argument 'Zc' ../../src/wield/control/algorithms/statespace/dense/test/test_SS_models.py:124: TypeError
- test_xfers2i(test_trigger, tpath_preclear, plot)[source][github]¶
This is a pytest needing documentation
code
1def test_xfers2i(test_trigger, tpath_preclear, plot): 2 settest( 3 test_trigger, 4 tjoin, 5 plot, 6 Zc=[-1 + 1j, -1 + 5j], 7 Zr=[-100, -200, -10, -10], 8 Pc=[-1 + 2j, -1 + 6j], 9 Pr=[-10, -20, -30], 10 k=1, 11 )
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.algorithms.statespace.dense.test.test_SS_models.test_xfers2iThe 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_xfers2i
output
status: failed duration: 0.000s captured errors: test_trigger = <function test_trigger.<locals>.fail at 0x7f52b15b1d00> tpath_preclear = None, plot = False def test_xfers2i(test_trigger, tpath_preclear, plot): > settest( test_trigger, tjoin, plot, Zc=[-1 + 1j, -1 + 5j], Zr=[-100, -200, -10, -10], Pc=[-1 + 2j, -1 + 6j], Pr=[-10, -20, -30], k=1, ) E TypeError: settest() got multiple values for argument 'Zc' ../../src/wield/control/algorithms/statespace/dense/test/test_SS_models.py:130: TypeError