Skip to content

FIX: Added some improvement to VirtualCompliance class #6096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/6096.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added some improvement to VirtualCompliance class
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/visualization/plot/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def add_image_with_aspect_ratio(self, path, caption="", max_width=None, max_heig
if max_width is None:
max_width = self.epw - 50 # Default to page width minus margins
if max_height is None:
max_height = self.eph - 50 # Default to page height minus margins
max_height = self.eph - 10 - (self.y - self.t_margin) # Default to page height minus margins

# Calculate aspect ratio
aspect_ratio = img_width / img_height
Expand Down
85 changes: 39 additions & 46 deletions src/ansys/aedt/core/visualization/post/compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,33 +795,20 @@
aedt_report = _design.post.create_report_from_configuration(
report_settings=local_config, solution_name=sw_name
)
if not aedt_report: # pragma: no cover
if not aedt_report or not aedt_report.traces: # pragma: no cover
_design.logger.error(f"Failed to create report {name}")
self._summary.append([template_report.name, "FAILED TO CREATE THE REPORT"])
self._summary_font.append([[255, 255, 255], [255, 0, 0]])

continue
aedt_report.hide_legend()

time.sleep(1)
if _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name):
time.sleep(1)
if tpx > 0:
compliance_reports.add_section()
compliance_reports.add_subchapter(f"{name}")
sleep_time = 10
while sleep_time > 0:
# noinspection PyBroadException
try:
compliance_reports.add_image(
{
"path": os.path.join(self._output_folder, aedt_report.plot_name + ".jpg"),
"caption": f"Plot {report_type} for {name}",
}
)
sleep_time = 0
except Exception: # pragma: no cover
time.sleep(1)
sleep_time -= 1
out = _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name)
if tpx > 0:
compliance_reports.add_section()
compliance_reports.add_subchapter(f"{name}")

if (
pass_fail
and report_type in ["standard", "frequency", "time"]
Expand All @@ -843,6 +830,14 @@
self._summary.append([template_report.name, "NO PASS/FAIL"])
self._summary_font.append(["", None])

if out:
compliance_reports.add_image(
{
"path": os.path.join(self._output_folder, aedt_report.plot_name + ".jpg"),
"caption": f"Plot {report_type} for {name}",
}
)

if self.local_config.get("delete_after_export", True):
aedt_report.delete()
_design.logger.info(f"Successfully parsed report {name}")
Expand All @@ -865,7 +860,7 @@
aedt_report = _design.post.create_report_from_configuration(
report_settings=local_config, solution_name=sw_name
)
if not aedt_report: # pragma: no cover
if not aedt_report or not aedt_report.traces: # pragma: no cover
_design.logger.error(f"Failed to create report {name}")
self._summary.append([template_report.name, "FAILED TO CREATE THE REPORT"])
self._summary_font.append([[255, 255, 255], [255, 0, 0]])
Expand All @@ -880,20 +875,6 @@
if tpx + tpx1 > 0:
compliance_reports.add_section()
compliance_reports.add_subchapter(f"{name}")
sleep_time = 10
while sleep_time > 0:
# noinspection PyBroadException
try:
compliance_reports.add_image(
{
"path": os.path.join(self._output_folder, aedt_report.plot_name + ".jpg"),
"caption": f"Plot {report_type} for {name}",
}
)
sleep_time = 0
except Exception: # pragma: no cover
time.sleep(1)
sleep_time -= 1
if pass_fail:
table = None
if report_type in ["frequency", "time"] and local_config.get("limitLines", None):
Expand Down Expand Up @@ -934,7 +915,12 @@
else:
self._summary.append([template_report.name, "NO PASS/FAIL"])
self._summary_font.append(["", None])

compliance_reports.add_image(
{
"path": os.path.join(self._output_folder, aedt_report.plot_name + ".jpg"),
"caption": f"Plot {report_type} for {name}",
}
)
if report_type in ["eye diagram", "statistical eye"]:
_design.logger.info("Adding eye measurements.")
table = self._add_eye_measurement(aedt_report, compliance_reports, image_name)
Expand Down Expand Up @@ -1048,9 +1034,9 @@
"Check Zone",
"Trace Name",
"Criteria",
"Pass/Fail limit value",
"Worst simulated value",
"X at worst value",
"Limit value",
"Worst freq.",
"Worst value",
"Test Result",
]
]
Expand Down Expand Up @@ -1112,7 +1098,7 @@
"title": f"Pass Fail Criteria on {image_name}",
"content": pass_fail_table,
"formatting": font_table,
"col_widths": [20, 45 if self.use_portrait else 200, 25, 25, 25, 25, 25],
"col_widths": [25, 45 if self.use_portrait else 195, 25, 25, 25, 25, 25],
}
)

Expand All @@ -1133,6 +1119,12 @@
result_value = "PASS"
points_to_check = [i[::-1] for i in local_config["eye_mask"]["points"]]
points_to_check = [[i[0] for i in points_to_check], [i[1] for i in points_to_check]]
points_to_check[0] = unit_converter(
points_to_check[0],
unit_system="Voltage",
input_units=local_config["eye_mask"].get("yunits", "V"),
output_units=sols.units_sweeps["__Amplitude"],
)
num_failed = 0
min_x = min(points_to_check[0])
max_x = max(points_to_check[0])
Expand Down Expand Up @@ -1213,6 +1205,12 @@
font_table = [["", None]]
points_to_check = [i[::-1] for i in local_config["eye_mask"]["points"]]
points_to_check = [[i[0] for i in points_to_check], [i[1] for i in points_to_check]]
points_to_check[0] = unit_converter(
points_to_check[0],
unit_system="Voltage",
input_units=local_config["eye_mask"].get("yunits", "V"),
output_units=sols.units_sweeps["__Amplitude"],
)
for ber in bit_error_rates:
mag_data = [k for k, i in sols.full_matrix_real_imag[0][sols.expressions[0]].items() if i <= ber]
mystr = f"Eye Mask Violation BER at {ber}:"
Expand Down Expand Up @@ -1341,7 +1339,7 @@
settings.logger.info("Specifications info added to the report.")
if self.dut_image:
dut = self.report_data.add_chapter("Device under test")
caption = "HFSS 3D Layout DUT victims and aggressors."
caption = "DUT drawing with victims and aggressors."

Check warning on line 1342 in src/ansys/aedt/core/visualization/post/compliance.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/visualization/post/compliance.py#L1342

Added line #L1342 was not covered by tests
dut.add_image({"path": self.dut_image, "caption": caption})

self._create_parameters()
Expand Down Expand Up @@ -1391,11 +1389,6 @@
report.add_chapter(chapter.title)
for content in chapter.content:
if content["type"] == 2:
# if "width" not in content["data"] and "height" not in content["data"]:
# if self.use_portrait:
# content["data"]["width"] = report.epw - 20
# else:
# content["data"]["height"] = report.eph - 50
report.add_image_with_aspect_ratio(**content["data"])
elif content["type"] == 3:
y = report.get_y()
Expand Down