Skip to content

Commit b7d0cf1

Browse files
FIX: Fix get insertion loss (#5964)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 971c79b commit b7d0cf1

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

doc/changelog.d/5964.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix get insertion loss

src/ansys/aedt/core/application/analysis_hf.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,29 @@ def get_all_insertion_loss_list(
162162
y = [i for i in receivers if el in i]
163163
for x1 in x:
164164
for y1 in y:
165-
if x1[-2:] == y1[-2:]:
166-
if math_formula:
165+
if x1[-2:] == y1[-2:] and x1 != y1:
166+
if (
167+
math_formula
168+
and f"{math_formula}(S({x1},{y1}))" not in spar
169+
and f"{math_formula}(S({y1},{x1}))" not in spar
170+
):
167171
spar.append(f"{math_formula}(S({x1},{y1}))")
168-
else:
172+
elif not math_formula and f"S({y1},{x1})" not in spar and f"S({x1},{y1})" not in spar:
169173
spar.append(f"S({x1},{y1})")
170174
break
171175
else:
172-
for i, j in zip(drivers, receivers):
173-
if math_formula:
174-
spar.append(f"{math_formula}(S({i},{j}))")
175-
else:
176-
spar.append(f"S({i},{j})")
176+
for i in drivers:
177+
for j in receivers:
178+
if i == j:
179+
continue
180+
if (
181+
math_formula
182+
and f"{math_formula}(S({j},{i}))" not in spar
183+
and f"{math_formula}(S({i},{j}))" not in spar
184+
):
185+
spar.append(f"{math_formula}(S({i},{j}))")
186+
elif not math_formula and f"S({i},{j})" not in spar and f"S({j},{i})" not in spar:
187+
spar.append(f"S({i},{j})")
177188
return spar
178189

179190
@pyaedt_function_handler(trlist="drivers", tx_prefix="drivers_prefix_name", net_list="nets")

tests/system/general/test_21_Circuit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ def test_05b_add_pin_iport(self, aedtapp):
133133
assert len(aedtapp.get_all_sparameter_list) == 3
134134
assert len(aedtapp.get_all_return_loss_list()) == 2
135135
assert len(aedtapp.get_all_return_loss_list(math_formula="abs")) == 2
136-
assert len(aedtapp.get_all_insertion_loss_list()) == 2
137-
assert len(aedtapp.get_all_insertion_loss_list(math_formula="abs")) == 2
138-
assert len(aedtapp.get_all_insertion_loss_list(math_formula="abs", nets=aedtapp.excitation_names)) == 2
136+
assert len(aedtapp.get_all_insertion_loss_list()) == 1
137+
assert len(aedtapp.get_all_insertion_loss_list(math_formula="abs")) == 1
138+
assert len(aedtapp.get_all_insertion_loss_list(math_formula="abs", nets="ive")) == 1
139139
assert len(aedtapp.get_next_xtalk_list()) == 1
140140
assert len(aedtapp.get_next_xtalk_list(math_formula="abs")) == 1
141141
assert len(aedtapp.get_fext_xtalk_list()) == 2

0 commit comments

Comments
 (0)