Skip to content

Commit 3781b06

Browse files
committed
fix python 3.9 tests
1 parent 78f89f0 commit 3781b06

File tree

1 file changed

+60
-64
lines changed

1 file changed

+60
-64
lines changed

tests/test_components/test_microwave.py

Lines changed: 60 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -65,78 +65,74 @@ def make_mw_sim(
6565

6666
metal_geos = []
6767

68-
match transmission_line_type:
69-
case "microstrip":
70-
metal_geos.append(
71-
td.Box(
72-
center=[0, 0, height + thickness / 2],
73-
size=[td.inf, width, thickness],
74-
)
75-
)
76-
case "cpw":
77-
metal_geos.append(
78-
td.Box(
79-
center=[0, 0, height + thickness / 2],
80-
size=[td.inf, width, thickness],
81-
)
68+
if transmission_line_type == "microstrip":
69+
metal_geos.append(
70+
td.Box(
71+
center=[0, 0, height + thickness / 2],
72+
size=[td.inf, width, thickness],
8273
)
83-
gnd_width = 10 * width
84-
gap = width / 5
85-
gnd_shift = gnd_width / 2 + gap + width / 2
86-
metal_geos.append(
87-
td.Box(
88-
center=[0, -gnd_shift, height + thickness / 2],
89-
size=[td.inf, gnd_width, thickness],
90-
)
74+
)
75+
elif transmission_line_type == "cpw":
76+
metal_geos.append(
77+
td.Box(
78+
center=[0, 0, height + thickness / 2],
79+
size=[td.inf, width, thickness],
9180
)
92-
metal_geos.append(
93-
td.Box(
94-
center=[0, gnd_shift, height + thickness / 2],
95-
size=[td.inf, gnd_width, thickness],
96-
)
81+
)
82+
gnd_width = 10 * width
83+
gap = width / 5
84+
gnd_shift = gnd_width / 2 + gap + width / 2
85+
metal_geos.append(
86+
td.Box(
87+
center=[0, -gnd_shift, height + thickness / 2],
88+
size=[td.inf, gnd_width, thickness],
9789
)
98-
case "coax":
99-
(
100-
metal_geos.append(
101-
td.GeometryGroup(
102-
geometries=(
103-
td.ClipOperation(
104-
operation="difference",
105-
geometry_a=td.Cylinder(
106-
axis=0, radius=2 * mm, center=(0, 0, 5 * mm), length=td.inf
107-
),
108-
geometry_b=td.Cylinder(
109-
axis=0, radius=1.8 * mm, center=(0, 0, 5 * mm), length=td.inf
110-
),
111-
),
112-
td.Cylinder(
113-
axis=0, radius=0.6 * mm, center=(0, 0, 5 * mm), length=td.inf
114-
),
115-
)
116-
)
117-
),
90+
)
91+
metal_geos.append(
92+
td.Box(
93+
center=[0, gnd_shift, height + thickness / 2],
94+
size=[td.inf, gnd_width, thickness],
11895
)
119-
120-
case "stripline":
121-
metal_geos.append(
122-
td.Box(
123-
center=[0, 0, 0],
124-
size=[td.inf, width, thickness],
96+
)
97+
elif transmission_line_type == "coax":
98+
metal_geos.append(
99+
td.GeometryGroup(
100+
geometries=(
101+
td.ClipOperation(
102+
operation="difference",
103+
geometry_a=td.Cylinder(
104+
axis=0, radius=2 * mm, center=(0, 0, 5 * mm), length=td.inf
105+
),
106+
geometry_b=td.Cylinder(
107+
axis=0, radius=1.8 * mm, center=(0, 0, 5 * mm), length=td.inf
108+
),
109+
),
110+
td.Cylinder(axis=0, radius=0.6 * mm, center=(0, 0, 5 * mm), length=td.inf),
125111
)
126112
)
127-
gnd_width = 10 * width
128-
metal_geos.append(
129-
td.Box(
130-
center=[0, 0, height + thickness],
131-
size=[td.inf, gnd_width, thickness],
132-
)
113+
)
114+
elif transmission_line_type == "stripline":
115+
metal_geos.append(
116+
td.Box(
117+
center=[0, 0, 0],
118+
size=[td.inf, width, thickness],
133119
)
134-
metal_geos.append(
135-
td.Box(
136-
center=[0, 0, -height - thickness],
137-
size=[td.inf, gnd_width, thickness],
138-
)
120+
)
121+
gnd_width = 10 * width
122+
metal_geos.append(
123+
td.Box(
124+
center=[0, 0, height + thickness],
125+
size=[td.inf, gnd_width, thickness],
139126
)
127+
)
128+
metal_geos.append(
129+
td.Box(
130+
center=[0, 0, -height - thickness],
131+
size=[td.inf, gnd_width, thickness],
132+
)
133+
)
134+
else:
135+
raise AssertionError("Incorrect argument")
140136

141137
metal_structures = [td.Structure(geometry=geo, medium=pec) for geo in metal_geos]
142138
substrate = td.Structure(

0 commit comments

Comments
 (0)