test_HTTS_v2

wield.control.fitting.SISO.test.v2.test_HTTS_v2

This is a pytest module needing documentation

pytest-html report

Functions

test_HTTS_P_L(request)

This is a pytest needing documentation

test_HTTS_Y_L(request)

This is a pytest needing documentation

test_HTTS_Y_L_reldeg(request)

This is a pytest needing documentation

Details

test_HTTS_P_L(request)[source][github]

This is a pytest needing documentation

code
 1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
 2def test_HTTS_P_L(request, ):
 3    data = testing_data_dev("HTTS_P_L")
 4    out = v2.data2filter(
 5        F_Hz=data.F_Hz,
 6        data=data.data,
 7        SNR=data.SNR,
 8        order_initial=20,
 9        hints=[sign_validate_and_plot_hint(tjoin('error'))],
10    )
11    with plot_on_assert(tjoin('output'), out.fitter, plot_anyway=True):
12        pass
13    # with digest_on_assert(__file__, request, out, plot_anyway = True):
14    #    pass
15    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.v2.test_HTTS_v2.test_HTTS_P_L

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_HTTS_P_L
output
{'F_Hz': array([0.3       , 0.31591058, 0.332665  , 0.35030797, 0.36888665,
       0.38845062, 0.40905222, 0.4307464 , 0.45359117, 0.47764748,
       0.50297964, 0.52965534, 0.55774575, 0.58732593, 0.6184749 ,
       0.6512759 , 0.68581647, 0.72218895, 0.7604904 , 0.8008233 ,
       0.8432951 , 0.8880195 , 0.9351159 , 0.98471   , 1.0369344 ,
       1.0919285 , 1.1498392 , 1.2108212 , 1.2750374 , 1.3426594 ,
       1.4138676 , 1.4888525 , 1.5678142 , 1.6509637 , 1.7385229 ,
       1.8307259 , 1.927819  , 2.0300615 , 2.1377263 , 2.251101  ,
       2.370489  , 2.4962084 , 2.6285954 , 2.7680037 , 2.9148057 ,
       3.0693932 , 3.2321792 , 3.4035985 , 3.5841093 , 3.7741935 ,
       3.974359  , 4.18514   , 4.4071    , 4.640832  , 4.8869596 ,
       5.146141  , 5.419068  , 5.7064695 , 6.009114  , 6.327809  ,
       6.663406  , 7.0168014 , 7.388939  , 7.7808137 , 8.193471  ,
       8.628014  , 9.085603  , 9.56746   ], dtype=float32), 'data': array([ 6.26657205e-03+3.36349418e-04j,  6.25598105e-03+3.43608117e-04j,
        6.20087981e-03+2.79483036e-04j,  6.09785551e-03+2.33245082e-04j,
        6.04991009e-03+1.61669654e-04j,  5.86760556e-03+5.41600712e-05j,
        5.66797424e-03-1.05478175e-04j,  5.34016220e-03-2.11176870e-04j,
        4.97082621e-03-3.62902385e-04j,  4.60434472e-03-5.04104246e-04j,
        3.95310903e-03-4.96785855e-04j,  3.24075157e-03-5.63028501e-04j,
        2.44789408e-03-4.97109198e-04j,  1.37176004e-03-3.80744023e-04j,
        1.26066239e-04-7.47091763e-05j, -1.34696986e-03+3.64144857e-04j,
       -3.22632981e-03+1.01031759e-03j, -5.58829959e-03+1.98084023e-03j,
       -8.52349680e-03+3.48959398e-03j, -1.23110665e-02+5.79148671e-03j,
       -1.75471883e-02+9.21454653e-03j, -2.38554925e-02+1.46850217e-02j,
       -3.16964425e-02+2.48544216e-02j, -4.34691198e-02+3.99214067e-02j,
       -5.38084805e-02+6.97819218e-02j, -5.71363047e-02+1.24355674e-01j,
       -2.10116804e-02+2.18069479e-01j,  1.26397669e-01+3.15680534e-01j,
        4.12499905e-01+2.23059475e-01j,  5.00969529e-01-1.61561877e-01j,
        1.99388400e-01-3.78067464e-01j, -2.53898818e-02-2.83329308e-01j,
       -8.85927603e-02-1.66694611e-01j, -8.50087553e-02-9.29021984e-02j,
       -6.94367364e-02-5.58795892e-02j, -5.53501956e-02-3.67235169e-02j,
       -4.40684929e-02-2.34637205e-02j, -3.69076245e-02-1.64711140e-02j,
       -3.00282110e-02-1.15612894e-02j, -2.53917184e-02-8.24316125e-03j,
       -2.14230549e-02-5.91475796e-03j, -1.84789300e-02-4.06909874e-03j,
       -1.58235207e-02-2.74005323e-03j, -1.38497343e-02-1.66656089e-03j,
       -1.17402989e-02-9.80053563e-04j, -9.85912979e-03-3.54936725e-04j,
       -8.55925214e-03-2.10470444e-06j, -7.36935623e-03+2.49393313e-04j,
       -6.28088415e-03+3.49266164e-04j, -5.49304904e-03+4.63029486e-04j,
       -4.55069495e-03+4.34313755e-04j, -3.91639583e-03+3.90814384e-04j,
       -3.61655699e-03+3.01423512e-04j, -3.17537249e-03+2.98641331e-04j,
       -2.68707052e-03+3.09247174e-04j, -2.40267790e-03+2.54282437e-04j,
       -2.14939308e-03+1.95540881e-04j, -1.82690460e-03+1.70343119e-04j,
       -1.64199038e-03+1.47657731e-04j, -1.32341182e-03+1.25263716e-04j,
       -1.14942016e-03+4.56628413e-06j, -9.77236312e-04-9.08011589e-06j,
       -8.70033284e-04+8.16742977e-06j, -8.82570050e-04-4.72888278e-05j,
       -9.65597632e-04-8.93408651e-06j, -6.72171591e-04+2.40430221e-04j,
       -5.93457778e-04-1.06613461e-05j, -5.90686162e-04-4.61619275e-05j],
      dtype=complex64), 'SNR': array([8.3184120e+06, 1.8965644e+07, 4.1718558e+06, 1.7043994e+06,
       4.7551265e+06, 3.9494482e+06, 4.4581600e+06, 5.7037306e+05,
       9.9085481e+05, 3.0935730e+06, 9.2809219e+05, 7.1427133e+04,
       2.6440331e+05, 4.4104561e+03, 1.0289489e+00, 2.7046399e+03,
       5.1088656e+05, 5.2988312e+05, 1.4995149e+07, 4.2753720e+06,
       2.7884720e+06, 4.5964388e+05, 1.6927789e+06, 2.3759456e+05,
       4.7395803e+05, 1.4576422e+05, 1.0755106e+05, 6.9135594e+04,
       3.8281227e+04, 2.5681225e+04, 6.1745590e+04, 1.9051036e+05,
       3.6284297e+04, 1.2782663e+05, 2.2100259e+05, 6.4284625e+05,
       7.2105806e+05, 3.6310252e+07, 9.3820808e+07, 6.4670725e+06,
       1.9736862e+07, 1.4452075e+06, 9.5468394e+05, 2.9372112e+05,
       3.6282125e+05, 2.8523997e+05, 3.0143628e+05, 5.2403819e+05,
       7.1500281e+04, 3.2441212e+05, 8.2282898e+04, 1.4196937e+04,
       1.0788927e+05, 1.2233660e+04, 3.2872477e+04, 2.4351320e+05,
       7.4074419e+05, 9.9376094e+03, 3.4667910e+03, 1.3082276e+04,
       1.9952886e+03, 3.0470044e+03, 1.0723019e+03, 6.1542969e+02,
       2.3638728e+02, 5.5699249e+02, 3.4465361e+03, 4.1210479e+03],
      dtype=float32), 'order_initial': 20, 'hints': [{'fitter_update_validate': <function sign_validate_and_plot_hint.<locals>.sign_validate_plot at 0x7f8020451e40>, 'fitter_check_validate': <function sign_validate_and_plot_hint.<locals>.sign_validate_plot at 0x7f8020451e40>, 'rational_fitter_validate': <function rational_fitter_validate at 0x7f8020dff1a0>}]}
TEE_LOGFILE None
A []
B []
------------:SNR Fix Test:
------------:rational fitting:
4P   0.02    chebychev rational fit
RELDEG:  0 0 0
3P   0.14    Initial Order: (Z=20, P=20, Z-P=0)
3P   0.21    Fastdrop Order: (Z=16, P=16, Z-P=0)
4P   0.24    mag fitting and phase patching
--------------:rational fitting:sample variance (from magnitude):
3A   0.82      Weight Scaling determined:  23.48957175530055
3A   0.82      Weight Scaling Used  4.8466041467506455
------------:Q-ranked order reduction:
4P   1.82    order reduced annealing
5P   2.77  zero flipping, maxzp 9, residuals=1.76e+02, 1.76e+02, reldeg=-1
2A  12.86  Baseline fit residuals: 1.76e+02, at order 9
------------:successive order reduction:
5P  19.93    order reduced to 8, residuals=1.75e+02
5P  28.11    order reduced to 8, residuals=1.67e+02
5P  29.56    order reduced to 6, residuals=4.15e+02
5P  32.03    order reduced to 6, residuals=1.97e+02
5P  34.08    order reduced to 6, residuals=3.69e+02
5P  34.88    order reduced to 4, residuals=6.90e+02
5P  35.51    order reduced to 2, residuals=3.35e+04
BASELINE:  9
------------:investigations:
2I  35.53    max(z, p)       ChiSq.
                   order    avg. res.    med. res.    max. res.
             -----------  -----------  -----------  -----------
                       2    33479.3     23745.9       421450
                       4      689.987     728.551       9627.2
                       6      196.784      95.3862      4301.59
                       8      167.27      116.047       4895.96
Captured stderr call
3W   0.01    The number of effective data points N=(ΣW^2)^2/(ΣW^4)=2.37e-02*len(W)
             [where W=SNR] is below the configured 'SNR_regularize_scale'=10,
             given the maximum SNR=93820808.0. Now Finding an SNR ceiling that balances
             the ratio with max SNR.
3W   0.01    Using SNR<236.3872833251953 ceiling.
3W   0.20    Fitter_checkpoint improvement succeed, None
3W   1.66  Fitter_checkpoint improvement succeed, None
3W   1.81    Fitter_checkpoint improvement succeed, None
3W   1.95    Fitter_checkpoint improvement succeed, None
3W   2.76  Fitter_checkpoint improvement succeed, None
3W  12.85  Fitter_checkpoint improvement succeed, None
test_HTTS_Y_L(request)[source][github]

This is a pytest needing documentation

code
 1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
 2def test_HTTS_Y_L(request, ):
 3    data = testing_data_dev("HTTS_Y_L")
 4    out = v2.data2filter(
 5        F_Hz=data.F_Hz,
 6        data=data.data,
 7        SNR=data.SNR,
 8        order_initial=20,
 9        hints=[sign_validate_and_plot_hint(tjoin('error'))],
10    )
11    with plot_on_assert(tjoin('output'), out.fitter, plot_anyway=True):
12        pass
13    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.v2.test_HTTS_v2.test_HTTS_Y_L

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_HTTS_Y_L
output
{'F_Hz': array([0.3       , 0.31591058, 0.332665  , 0.35030797, 0.36888665,
       0.38845062, 0.40905222, 0.4307464 , 0.45359117, 0.47764748,
       0.50297964, 0.52965534, 0.55774575, 0.58732593, 0.6184749 ,
       0.6512759 , 0.68581647, 0.72218895, 0.7604904 , 0.8008233 ,
       0.8432951 , 0.8880195 , 0.9351159 , 0.98471   , 1.0369344 ,
       1.0919285 , 1.1498392 , 1.2108212 , 1.2750374 , 1.3426594 ,
       1.4138676 , 1.4888525 , 1.5678142 , 1.6509637 , 1.7385229 ,
       1.8307259 , 1.927819  , 2.0300615 , 2.1377263 , 2.251101  ,
       2.370489  , 2.4962084 , 2.6285954 , 2.7680037 , 2.9148057 ,
       3.0693932 , 3.2321792 , 3.4035985 , 3.5841093 , 3.7741935 ,
       3.974359  , 4.18514   , 4.4071    , 4.640832  , 4.8869596 ,
       5.146141  , 5.419068  , 5.7064695 , 6.009114  , 6.327809  ,
       6.663406  , 7.0168014 , 7.388939  , 7.7808137 , 8.193471  ,
       8.628014  , 9.085603  , 9.56746   ], dtype=float32), 'data': array([ 7.69708352e-03+1.88647115e-04j,  7.71694304e-03+1.64625279e-04j,
        7.98650272e-03+1.70850180e-04j,  8.10783170e-03+1.17214913e-04j,
        8.24236777e-03+5.64253787e-05j,  8.40548985e-03-6.73616159e-05j,
        8.59375298e-03-2.15381559e-04j,  8.87502823e-03-3.18981241e-04j,
        8.99362005e-03-4.92383842e-04j,  9.07130446e-03-6.30910858e-04j,
        9.26269591e-03-8.57356354e-04j,  9.34286881e-03-9.91831766e-04j,
        9.41749196e-03-1.15720672e-03j,  9.58323386e-03-1.30758516e-03j,
        9.80107300e-03-1.46633154e-03j,  1.00330198e-02-1.71570713e-03j,
        1.03774555e-02-1.82686292e-03j,  1.08236624e-02-2.09053955e-03j,
        1.12831704e-02-2.33364687e-03j,  1.19829169e-02-2.70329299e-03j,
        1.29821254e-02-3.15852463e-03j,  1.40425591e-02-3.72272264e-03j,
        1.56027265e-02-4.75011999e-03j,  1.82581972e-02-6.23423234e-03j,
        2.16406118e-02-9.57186799e-03j,  2.62307189e-02-1.62536670e-02j,
        2.97282003e-02-3.09389550e-02j,  2.14375257e-02-5.80745265e-02j,
       -2.56073549e-02-7.62012377e-02j, -8.62303898e-02-3.25199999e-02j,
       -6.45838976e-02+4.43714410e-02j, -3.58453626e-03+5.77501580e-02j,
        3.40101384e-02+3.06373946e-02j,  3.65021527e-02-4.47911769e-03j,
        1.81211904e-02-2.19406448e-02j,  2.75514717e-03-2.17657983e-02j,
       -3.69950826e-03-1.53610501e-02j, -6.26219204e-03-1.06040817e-02j,
       -6.13016589e-03-7.18047703e-03j, -5.84707689e-03-4.90359776e-03j,
       -5.08184312e-03-3.37584177e-03j, -4.52123769e-03-2.23394134e-03j,
       -4.26784251e-03-1.56559667e-03j, -3.64011596e-03-9.99783631e-04j,
       -3.16493725e-03-5.96167054e-04j, -2.77468236e-03-2.10247264e-04j,
       -2.28362856e-03-8.55092949e-05j, -1.78612734e-03+5.61557317e-05j,
       -1.53203413e-03+8.79380095e-05j, -1.16667233e-03+1.15691226e-04j,
       -1.07761996e-03+1.19403718e-04j, -9.08756920e-04+9.99966505e-05j,
       -6.47442823e-04+7.11724206e-05j, -5.15936641e-04+3.80427409e-05j,
       -6.00506610e-04+4.46381200e-05j, -4.68522572e-04+4.89799895e-05j,
       -3.30825191e-04+1.86624166e-05j, -3.58957361e-04+4.17257143e-05j,
       -3.15489335e-04+3.58919533e-05j, -3.24494875e-04-1.27699177e-05j,
       -3.04049114e-04+1.04072251e-05j, -2.96516926e-04-2.95402497e-05j,
       -3.14581353e-04-6.28239068e-05j, -2.44472234e-04-4.52930472e-05j,
       -2.00084643e-04-3.91148533e-05j, -9.19199301e-05+6.41346051e-05j,
       -7.16933282e-05-6.73393588e-05j, -1.00374717e-04-6.04890374e-05j],
      dtype=complex64), 'SNR': array([1.3275474e+07, 5.3262530e+06, 2.8175798e+06, 2.2548828e+05,
       9.4804019e+05, 4.9070730e+06, 5.6383950e+06, 1.2442429e+08,
       7.3481665e+06, 2.9148000e+06, 1.7800986e+07, 1.4197048e+08,
       5.1048480e+07, 2.7482272e+08, 3.9894668e+07, 2.5408968e+07,
       1.7482924e+07, 1.1816090e+07, 3.9536580e+07, 2.7052854e+08,
       5.8148780e+06, 6.0349825e+06, 2.2304988e+07, 3.5612430e+06,
       8.6483460e+06, 6.5280356e+05, 3.3251504e+04, 3.2008275e+04,
       5.2474487e+03, 1.1012148e+04, 2.1032062e+04, 6.3431931e+05,
       2.0275416e+05, 2.1165735e+06, 5.5447578e+04, 8.4114281e+04,
       4.9681004e+04, 7.9639460e+06, 1.7065251e+06, 2.0867708e+06,
       1.5962190e+06, 2.6169620e+05, 2.2424035e+06, 9.8850512e+05,
       1.9090841e+05, 1.4231462e+05, 1.4806786e+04, 2.7101982e+04,
       1.7778895e+03, 3.2235215e+03, 2.4746475e+03, 6.3499657e+01,
       1.6896085e+02, 3.4305683e+01, 8.1476891e+01, 3.0881732e+02,
       1.3786995e+02, 9.4301865e+01, 1.4036640e+01, 4.4287482e+02,
       1.7489172e+02, 2.4404325e+01, 9.0156433e+01, 7.9770527e+00,
       5.0196791e+00, 3.5699093e+00, 2.3833251e+00, 6.9880581e+00],
      dtype=float32), 'order_initial': 20, 'hints': [{'fitter_update_validate': <function sign_validate_and_plot_hint.<locals>.sign_validate_plot at 0x7f80149e2e80>, 'fitter_check_validate': <function sign_validate_and_plot_hint.<locals>.sign_validate_plot at 0x7f80149e2e80>, 'rational_fitter_validate': <function rational_fitter_validate at 0x7f8020dff1a0>}]}
TEE_LOGFILE None
A []
B []
------------:SNR Fix Test:
------------:rational fitting:
4P   0.01    chebychev rational fit
RELDEG:  0 0 0
3P   0.12    Initial Order: (Z=20, P=20, Z-P=0)
3P   0.20    Fastdrop Order: (Z=18, P=18, Z-P=0)
4P   0.22    mag fitting and phase patching
--------------:rational fitting:sample variance (from magnitude):
3A   1.23      Weight Scaling determined:  3.247037998935997
3A   1.23      Weight Scaling Used  1.8019539391826855
------------:Q-ranked order reduction:
4P   3.88    order reduced annealing
5P   5.84  zero flipping, maxzp 11, residuals=2.71e+01, 2.71e+01, reldeg=-1
<wield.control.fitting.SISO.fitters_ZPK.MRF.MultiReprFilterS object at 0x7f800e6f53a0>
None
rB(-1.506993796466597, -0.01591056585312008, 0.06639339599888358±1.3367650824632533j, 3.351768596992201±1.7156926285182532j, -7.314816367232943±4.551267542979521j, -2.324553308881896±7.529158576675889j)
rB()
<wield.control.fitting.SISO.representations.zpk_with_data.ZPKwData object at 0x7f800e6f4590>
Captured stderr call
3W   0.01    The number of effective data points N=(ΣW^2)^2/(ΣW^4)=4.65e-02*len(W)
             [where W=SNR] is below the configured 'SNR_regularize_scale'=10,
             given the maximum SNR=274822720.0. Now Finding an SNR ceiling that balances
             the ratio with max SNR.
3W   0.01    Using SNR<81.47689056396484 ceiling.
3W   0.18    Fitter_checkpoint improvement succeed, None
5W   1.28    High Confidence that an unstable zero exists at 0.2936392149606798+1.540140388951137i Hz
             Adding it to the filter. Prevent this with 'never_unstable_zeros'
3W   3.60  Fitter_checkpoint improvement succeed, None
3W   3.87    Fitter_checkpoint improvement succeed, None
3W   4.30    Fitter_checkpoint improvement succeed, None
3W   5.82  Fitter_checkpoint improvement succeed, None
captured errors:
request = <FixtureRequest for <Function test_HTTS_Y_L>>

    @pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
    def test_HTTS_Y_L(request, ):
        data = testing_data_dev("HTTS_Y_L")
>       out = v2.data2filter(
            F_Hz=data.F_Hz,
            data=data.data,
            SNR=data.SNR,
            order_initial=20,
            hints=[sign_validate_and_plot_hint(tjoin('error'))],
        )

../../src/wield/control/fitting/SISO/test/v2/test_HTTS_v2.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../src/wield/control/fitting/SISO/v2/data2filter.py:423: in data2filter
    baseline_order = fit_full(aid, emphasis)
../../src/wield/control/fitting/SISO/v2/data2filter.py:489: in fit_full
    return _reduce(aid)
../../src/wield/control/fitting/SISO/v2/data2filter.py:1135: in _reduce
    order_reduce_flip.order_reduce_flip(
../../src/wield/control/fitting/SISO/v2/algorithms/order_reduce_flip.py:136: in order_reduce_flip
    ret = ranking_delay_flip(
../../src/wield/control/fitting/SISO/v2/algorithms/order_reduce_flip.py:94: in ranking_delay_flip
    did_reduce = aid.fitter_check(
../../src/wield/control/fitting/SISO/v2/fit_aid.py:371: in fitter_check
    val_func(self, fitter_new)
../../src/wield/control/fitting/SISO/testing/utilities.py:219: in sign_validate_plot
    sign_validate(aid, fitter)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

aid = <wield.control.fitting.SISO.v2.fit_aid.FitAid object at 0x7f8015ceea80>
fitter = <wield.control.fitting.SISO.fitters_ZPK.MRF.MultiReprFilterS object at 0x7f800e6f53a0>

    def sign_validate(aid, fitter):
        """
        To be added as a hint to data2filter
        """
        rep = fitter.ZPKrep
        xfer = rep.xfer_fit
        data = rep.data
        rat = data / xfer
        rat_ang = np.exp(1j * np.angle(rat))
        ang_avg_rep = np.sum(rat_ang * rep.W ** 2) / np.sum(rep.W ** 2)

        xfer = fitter.xfer_fit
        data = fitter.data
        rat = data / xfer
        rat_ang = np.exp(1j * np.angle(rat))
        ang_avg_fit = np.sum(rat_ang * fitter.W ** 2) / np.sum(fitter.W ** 2)
        # print("SGN: ", ang_avg_rep, ang_avg_fit)
        # axB = plots.plots.plot_fit(
        #    fitter,
        #    fname = 'test1.png',
        # )
        # axB = plots.plots.plot_fitter_flag(
        #    fitter,
        #    fname = 'test3.png',
        # )
        # axB = plots.plots.plot_fit(
        #    fitter.ZPKrep,
        #    fname = 'test2.png',
        # )

        if isinstance(fitter, fitters_ZPK.MultiReprFilterBase):
            for coding in list(fitter.num_codings) + list(fitter.den_codings):
                rB = representations.RootBunch(
                    u=coding.roots(),
                    constraint=representations.root_constraints.no_constraint,
                )
                h1 = coding.transfer()
                h, lnG = rB.val_lnG(fitter.Xex_grid)
                h = h * np.exp(lnG)
                assert_almost_equal(h / h1, 1, 4)

>       assert ang_avg_fit.real > 0 and ang_avg_rep.real > 0
E       AssertionError

../../src/wield/control/fitting/SISO/testing/utilities.py:191: AssertionError
test_HTTS_Y_L_reldeg(request)[source][github]

This is a pytest needing documentation

code
 1@pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
 2def test_HTTS_Y_L_reldeg(request, ):
 3    def reldeg_validate(aid, fitter):
 4        rdmax = aid.hint("relative_degree_max")
 5        rdmin = aid.hint("relative_degree_min")
 6        orders = aid.fitter_orders(fitter)
 7        # print("DEGREE", orders.total, orders.reldeg, rdmin, rdmax)
 8        if rdmax is not None:
 9            assert orders.reldeg <= rdmax
10        if rdmin is not None:
11            assert orders.reldeg >= rdmin
12
13    hint = {
14        "fitter_update_validate": reldeg_validate,
15        "fitter_check_validate": reldeg_validate,
16    }
17    data = testing_data_dev("HTTS_Y_L")
18    out = v2.data2filter(
19        F_Hz=data.F_Hz,
20        data=data.data,
21        SNR=data.SNR,
22        order_initial=20,
23        hints=[hint],
24        relative_degree=-2,
25        log_level=10,
26        log_level_debug=10,
27    )
28    with plot_on_assert(tjoin('plot'), out.fitter, plot_anyway=True):
29        pass
30    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.v2.test_HTTS_v2.test_HTTS_Y_L_reldeg

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_HTTS_Y_L_reldeg
output
{'F_Hz': array([0.3       , 0.31591058, 0.332665  , 0.35030797, 0.36888665,
       0.38845062, 0.40905222, 0.4307464 , 0.45359117, 0.47764748,
       0.50297964, 0.52965534, 0.55774575, 0.58732593, 0.6184749 ,
       0.6512759 , 0.68581647, 0.72218895, 0.7604904 , 0.8008233 ,
       0.8432951 , 0.8880195 , 0.9351159 , 0.98471   , 1.0369344 ,
       1.0919285 , 1.1498392 , 1.2108212 , 1.2750374 , 1.3426594 ,
       1.4138676 , 1.4888525 , 1.5678142 , 1.6509637 , 1.7385229 ,
       1.8307259 , 1.927819  , 2.0300615 , 2.1377263 , 2.251101  ,
       2.370489  , 2.4962084 , 2.6285954 , 2.7680037 , 2.9148057 ,
       3.0693932 , 3.2321792 , 3.4035985 , 3.5841093 , 3.7741935 ,
       3.974359  , 4.18514   , 4.4071    , 4.640832  , 4.8869596 ,
       5.146141  , 5.419068  , 5.7064695 , 6.009114  , 6.327809  ,
       6.663406  , 7.0168014 , 7.388939  , 7.7808137 , 8.193471  ,
       8.628014  , 9.085603  , 9.56746   ], dtype=float32), 'data': array([ 7.69708352e-03+1.88647115e-04j,  7.71694304e-03+1.64625279e-04j,
        7.98650272e-03+1.70850180e-04j,  8.10783170e-03+1.17214913e-04j,
        8.24236777e-03+5.64253787e-05j,  8.40548985e-03-6.73616159e-05j,
        8.59375298e-03-2.15381559e-04j,  8.87502823e-03-3.18981241e-04j,
        8.99362005e-03-4.92383842e-04j,  9.07130446e-03-6.30910858e-04j,
        9.26269591e-03-8.57356354e-04j,  9.34286881e-03-9.91831766e-04j,
        9.41749196e-03-1.15720672e-03j,  9.58323386e-03-1.30758516e-03j,
        9.80107300e-03-1.46633154e-03j,  1.00330198e-02-1.71570713e-03j,
        1.03774555e-02-1.82686292e-03j,  1.08236624e-02-2.09053955e-03j,
        1.12831704e-02-2.33364687e-03j,  1.19829169e-02-2.70329299e-03j,
        1.29821254e-02-3.15852463e-03j,  1.40425591e-02-3.72272264e-03j,
        1.56027265e-02-4.75011999e-03j,  1.82581972e-02-6.23423234e-03j,
        2.16406118e-02-9.57186799e-03j,  2.62307189e-02-1.62536670e-02j,
        2.97282003e-02-3.09389550e-02j,  2.14375257e-02-5.80745265e-02j,
       -2.56073549e-02-7.62012377e-02j, -8.62303898e-02-3.25199999e-02j,
       -6.45838976e-02+4.43714410e-02j, -3.58453626e-03+5.77501580e-02j,
        3.40101384e-02+3.06373946e-02j,  3.65021527e-02-4.47911769e-03j,
        1.81211904e-02-2.19406448e-02j,  2.75514717e-03-2.17657983e-02j,
       -3.69950826e-03-1.53610501e-02j, -6.26219204e-03-1.06040817e-02j,
       -6.13016589e-03-7.18047703e-03j, -5.84707689e-03-4.90359776e-03j,
       -5.08184312e-03-3.37584177e-03j, -4.52123769e-03-2.23394134e-03j,
       -4.26784251e-03-1.56559667e-03j, -3.64011596e-03-9.99783631e-04j,
       -3.16493725e-03-5.96167054e-04j, -2.77468236e-03-2.10247264e-04j,
       -2.28362856e-03-8.55092949e-05j, -1.78612734e-03+5.61557317e-05j,
       -1.53203413e-03+8.79380095e-05j, -1.16667233e-03+1.15691226e-04j,
       -1.07761996e-03+1.19403718e-04j, -9.08756920e-04+9.99966505e-05j,
       -6.47442823e-04+7.11724206e-05j, -5.15936641e-04+3.80427409e-05j,
       -6.00506610e-04+4.46381200e-05j, -4.68522572e-04+4.89799895e-05j,
       -3.30825191e-04+1.86624166e-05j, -3.58957361e-04+4.17257143e-05j,
       -3.15489335e-04+3.58919533e-05j, -3.24494875e-04-1.27699177e-05j,
       -3.04049114e-04+1.04072251e-05j, -2.96516926e-04-2.95402497e-05j,
       -3.14581353e-04-6.28239068e-05j, -2.44472234e-04-4.52930472e-05j,
       -2.00084643e-04-3.91148533e-05j, -9.19199301e-05+6.41346051e-05j,
       -7.16933282e-05-6.73393588e-05j, -1.00374717e-04-6.04890374e-05j],
      dtype=complex64), 'SNR': array([1.3275474e+07, 5.3262530e+06, 2.8175798e+06, 2.2548828e+05,
       9.4804019e+05, 4.9070730e+06, 5.6383950e+06, 1.2442429e+08,
       7.3481665e+06, 2.9148000e+06, 1.7800986e+07, 1.4197048e+08,
       5.1048480e+07, 2.7482272e+08, 3.9894668e+07, 2.5408968e+07,
       1.7482924e+07, 1.1816090e+07, 3.9536580e+07, 2.7052854e+08,
       5.8148780e+06, 6.0349825e+06, 2.2304988e+07, 3.5612430e+06,
       8.6483460e+06, 6.5280356e+05, 3.3251504e+04, 3.2008275e+04,
       5.2474487e+03, 1.1012148e+04, 2.1032062e+04, 6.3431931e+05,
       2.0275416e+05, 2.1165735e+06, 5.5447578e+04, 8.4114281e+04,
       4.9681004e+04, 7.9639460e+06, 1.7065251e+06, 2.0867708e+06,
       1.5962190e+06, 2.6169620e+05, 2.2424035e+06, 9.8850512e+05,
       1.9090841e+05, 1.4231462e+05, 1.4806786e+04, 2.7101982e+04,
       1.7778895e+03, 3.2235215e+03, 2.4746475e+03, 6.3499657e+01,
       1.6896085e+02, 3.4305683e+01, 8.1476891e+01, 3.0881732e+02,
       1.3786995e+02, 9.4301865e+01, 1.4036640e+01, 4.4287482e+02,
       1.7489172e+02, 2.4404325e+01, 9.0156433e+01, 7.9770527e+00,
       5.0196791e+00, 3.5699093e+00, 2.3833251e+00, 6.9880581e+00],
      dtype=float32), 'order_initial': 20, 'hints': [{'fitter_update_validate': <function test_HTTS_Y_L_reldeg.<locals>.reldeg_validate at 0x7f8015d0b920>, 'fitter_check_validate': <function test_HTTS_Y_L_reldeg.<locals>.reldeg_validate at 0x7f8015d0b920>}], 'relative_degree': -2, 'log_level': 10, 'log_level_debug': 10}
TEE_LOGFILE None
A []
B []
------------:SNR Fix Test:
9D   0.01    W:ratio 0.5 0.9999617877528195 0.5522913089862389 0 34 261696.203125
9D   0.01    W:ratio 0.5 0.9943753535572971 0.7536478191511553 0 17 1777.8895263671875
9D   0.01    W:ratio 0.5 0.842518833592634 0.8962845990314582 8 17 63.499656677246094
9D   0.01    W:ratio 0.5 0.92746787789644 0.8614878261917941 8 12 137.8699493408203
9D   0.01    W:ratio 0.5 0.8890816810786915 0.8855187597956757 8 10 90.15643310546875
9D   0.01    W:ratio 0.5 0.8772658120507271 0.8889740719599489 9 10 81.47689056396484
Captured stderr call
3W   0.01    The number of effective data points N=(ΣW^2)^2/(ΣW^4)=4.65e-02*len(W)
             [where W=SNR] is below the configured 'SNR_regularize_scale'=10,
             given the maximum SNR=274822720.0. Now Finding an SNR ceiling that balances
             the ratio with max SNR.
3W   0.01    Using SNR<81.47689056396484 ceiling.
captured errors:
request = <FixtureRequest for <Function test_HTTS_Y_L_reldeg>>

    @pytest.mark.skipif(module_import_skip, reason="cannot import IIRrational_test_data")
    def test_HTTS_Y_L_reldeg(request, ):
        def reldeg_validate(aid, fitter):
            rdmax = aid.hint("relative_degree_max")
            rdmin = aid.hint("relative_degree_min")
            orders = aid.fitter_orders(fitter)
            # print("DEGREE", orders.total, orders.reldeg, rdmin, rdmax)
            if rdmax is not None:
                assert orders.reldeg <= rdmax
            if rdmin is not None:
                assert orders.reldeg >= rdmin

        hint = {
            "fitter_update_validate": reldeg_validate,
            "fitter_check_validate": reldeg_validate,
        }
        data = testing_data_dev("HTTS_Y_L")
>       out = v2.data2filter(
            F_Hz=data.F_Hz,
            data=data.data,
            SNR=data.SNR,
            order_initial=20,
            hints=[hint],
            relative_degree=-2,
            log_level=10,
            log_level_debug=10,
        )

../../src/wield/control/fitting/SISO/test/v2/test_HTTS_v2.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../src/wield/control/fitting/SISO/v2/data2filter.py:423: in data2filter
    baseline_order = fit_full(aid, emphasis)
../../src/wield/control/fitting/SISO/v2/data2filter.py:486: in fit_full
    aid.fitter_update(representative=True, validate=True)
../../src/wield/control/fitting/SISO/v2/fit_aid.py:459: in fitter_update
    val_func(self, fitter)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

aid = <wield.control.fitting.SISO.v2.fit_aid.FitAid object at 0x7f8015b0b0b0>
fitter = <wield.control.fitting.SISO.fitters_ZPK.MRF.MultiReprFilterS object at 0x7f80149da270>

    def reldeg_validate(aid, fitter):
        rdmax = aid.hint("relative_degree_max")
        rdmin = aid.hint("relative_degree_min")
        orders = aid.fitter_orders(fitter)
        # print("DEGREE", orders.total, orders.reldeg, rdmin, rdmax)
        if rdmax is not None:
>           assert orders.reldeg <= rdmax
E           assert 0 <= -2
E            +  where 0 = Bunch(z=0, \n    p=0, \n    factors_z=0, \n    factors_p=0, \n    maxzp=0, \n    factors_maxzp=0, \n    factors_reldeg=0, \n    total=0, \n    reldeg=0).reldeg

../../src/wield/control/fitting/SISO/test/v2/test_HTTS_v2.py:63: AssertionError