test_disc_convergence

wield.control.fitting.SISO.test.ratdisc.test_disc_convergence

This is a pytest module needing documentation

pytest-html report

Functions

test_disc_convergence()

This is a pytest needing documentation

Details

test_disc_convergence()[source][github]

This is a pytest needing documentation

code
 1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
 2def test_disc_convergence():
 3    data = testing_data_dev("quad_M0_P2V_10Hz")
 4    SNR = np.minimum(data.SNR, 100)
 5    F_nyquist_Hz = np.max(data.F_Hz)
 6    fitter = fitters_rational.RationalDiscFilter(
 7        F_Hz=data.F_Hz,
 8        data=data.data,
 9        W=SNR,
10        F_nyquist_Hz=F_nyquist_Hz,
11        npoles=100,
12        nzeros=100,
13    )
14    print("data", fitter.data)
15    print("W", fitter.W)
16    print("h_a", fitter.h_a.xfer, fitter.h_a.lnG)
17    print("h_b", fitter.h_b.xfer, fitter.h_b.lnG)
18    fitter.fit_zeros()
19    fitter.fit_poles()
20    print("h_a", fitter.h_a.xfer[0], fitter.h_a.lnG)
21    print("h_b", fitter.h_b.xfer[0], fitter.h_b.lnG)
22    fitter.fit_zeros()
23    print("h_a", fitter.h_a.xfer[0], fitter.h_a.lnG)
24    print("h_b", fitter.h_b.xfer[0], fitter.h_b.lnG)
25    fitter.fit_poles()
26    fitter.fit_zeros()
27    fitter.fit_SVD()
28    fitter.fit_poles()
29    fitter.fit_zeros()
30    fitter.matched_pairs_clear(Q_rank_cutoff=0.3)
31    fitter.stabilize = True
32    # fitter.npoles = len(fitter.poles)
33    # fitter.nzeros = len(fitter.zeros)
34    ##fitter.stabilize = True
35    fitter.fit_poles()
36    fitter.fit_zeros()
37    fitter.fit_poles()
38    fitter.fit_zeros()
39    fitter.fit_SVD()
40    fitter.fit_poles()
41    fitter.fit_zeros()
42    fitter.fit_poles()
43    fitter.fit_zeros()
44    fitter.fit_poles()
45    fitter.fit_zeros()
46    fitter.matched_pairs_clear(Q_rank_cutoff=0.7)
47
48    # TODO
49    #!Make this a TEST so it doesn't plot all of the time
50
51    axB = plots.plot_fit(
52        fitter,
53        plot_zp=True,
54        # plot_past_data = False,
55        plot_past_data=True,
56        xscale="log",
57    )
58
59    axB.save(tjoin("disc-convergence"))
60    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.ratdisc.test_disc_convergence.test_disc_convergence

The 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_disc_convergence
output
data [ 2.5527173e-04-5.4735614e-05j  1.4490190e-04+9.5448333e-05j
  1.6089463e-04+4.5499619e-05j ... -3.7766365e-06+1.7787797e-06j
 -3.7128011e-06+2.1219641e-06j -4.8085726e-06+2.3245782e-06j]
W [  0.           0.48792982  52.257023   ... 100.         100.
 100.        ]
h_a [1.+0.j 1.+0.j 1.+0.j ... 1.+0.j 1.+0.j 1.+0.j] 0
h_b [1.+0.j 1.+0.j 1.+0.j ... 1.+0.j 1.+0.j 1.+0.j] 0
h_a (0.7801290627689925+0.04016193442765767j) 0
h_b (-184.2352251621759-25.563026186830463j) 0
h_a (0.7801290627689925+0.04016193442765767j) 0
h_b (50.183319834879185+2.175622503546895j) 0