T_SFLU_FC

wield.control.SFLU.test.T_SFLU_FC

This is a pytest module needing documentation

pytest-html report

Functions

T_SFLU_FP()

Setup a cavity with fields a2:a1 ---- b1:b2

Details

T_SFLU_FP()[source][github]

Setup a cavity with fields a2:a1 —- b1:b2

code
docstring
"""
Setup a cavity with fields
a2:a1 ---- b1:b2
"""
 1def T_SFLU_FP():
 2
 3
 4    edges = {
 5        ("a2_o", "a2_i"): "r_a2",  # make this a load operator
 6        ("a1_o", "a2_i"): "t_a",
 7        ("a1_o", "a1_i"): "r_a",
 8        ("a2_o", "a1_i"): "t_a",
 9        ("b1_o", "b1_i"): "r_b",
10        ("b2_o", "b1_i"): "t_b",
11        ("b2_o", "b2_i"): "r_b2",  # make this a load operator
12        ("b1_o", "b2_i"): "t_b",
13        ("b1_i", "a1_o"): "Lmat",
14        ("a1_i", "b1_o"): "Lmat",
15    }
16    sflu = SFLU.SFLU(edges)
17    print("inputs", sflu.inputs)
18    print("outputs", sflu.outputs)
19
20    print("row1", sflu.row)
21    print("row2", sflu.row2)
22    print("col1", sflu.col)
23    print("col2", sflu.col2)
24    print("-----------------------")
25    sflu.reduce("a1_i")
26    sflu.reduce("b1_i")
27    sflu.reduce("b1_o")
28    sflu.reduce("a1_o")
29    # sflu.reduce('a2_i')
30    # sflu.reduce('a2_o')
31    # sflu.reduce('b2_i')
32    # sflu.reduce('b2_o')
33    print("-----------------------")
34
35    print("row1", sflu.row)
36    print("row2", sflu.row2)
37    print("col1", sflu.col)
38    print("col2", sflu.col2)
39    dprint(sflu.oplistE)
40    oplistN = sflu.subinverse("a2_o", "a2_i")
41    dprint(oplistN)
42
43    F_Hz = logspaced(1, 1e5, 1000)
44    L_m = 4000
45    i2pi = 2j * np.pi
46    R_a = 0.01
47    c_m_s = 3e8
48
49    Espace = computeLU(
50        oplistE=sflu.oplistE,
51        edges=sflu.edges_original,
52        nodesizes={},
53        defaultsize=2,
54        **dict(
55            r_a=ilib.Id * R_a ** 0.5,
56            r_a2=ilib.Id * -(R_a ** 0.5),
57            t_a=ilib.Id * (1 - R_a) ** 0.5,
58            r_b=ilib.Id * 1,
59            t_b=ilib.Id * 0,
60            r_b2=ilib.Id * -1,
61            # Lmat = ilib.Mrotation(2 * np.pi * F_Hz * c_m_s / L_m),
62            Lmat=ilib.diag(np.exp(-i2pi * F_Hz * L_m / c_m_s)),
63        ),
64    )
65    # print("ESPACE: ", Espace)
66    # print(list(Espace.keys()))
67
68    SI = compute_subinverse(
69        oplistN=oplistN,
70        Espace=Espace,
71        nodesizes={},
72        defaultsize=2,
73    )
74    axB = mplfigB(Nrows=2)
75    axB.ax0.loglog(F_Hz, abs(SI[:, 0, 0]))
76    axB.ax1.semilogx(F_Hz, np.angle(SI[:, 0, 0]))
77    axB.save(tjoin("reflSI"))
78    # print(Espace)
79    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.SFLU.test.T_SFLU_FC.T_SFLU_FP

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.

T_SFLU_FP
output
inputs {'a2_i', 'b2_i'}
outputs {'b2_o', 'a2_o'}
captured errors:
def T_SFLU_FP():
        """
        Setup a cavity with fields
        a2:a1 ---- b1:b2
        """

        edges = {
            ("a2_o", "a2_i"): "r_a2",  # make this a load operator
            ("a1_o", "a2_i"): "t_a",
            ("a1_o", "a1_i"): "r_a",
            ("a2_o", "a1_i"): "t_a",
            ("b1_o", "b1_i"): "r_b",
            ("b2_o", "b1_i"): "t_b",
            ("b2_o", "b2_i"): "r_b2",  # make this a load operator
            ("b1_o", "b2_i"): "t_b",
            ("b1_i", "a1_o"): "Lmat",
            ("a1_i", "b1_o"): "Lmat",
        }
        sflu = SFLU.SFLU(edges)
        print("inputs", sflu.inputs)
        print("outputs", sflu.outputs)

>       print("row1", sflu.row)
E       AttributeError: 'SFLU' object has no attribute 'row'

../../src/wield/control/SFLU/test/T_SFLU_FC.py:51: AttributeError