Skip to content

FEAT: Compare edbs #1311

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 27 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6262d4b
REFACTOR: EDB configuration example for DCIR setup
gkorompi Nov 28, 2024
f0ad542
Merge branch 'dcir_example'
gkorompi Nov 29, 2024
4b6cb46
Merge remote-tracking branch 'origin/main'
gkorompi Dec 19, 2024
c0fcbf7
Merge remote-tracking branch 'origin/main'
gkorompi Jan 9, 2025
b18af1a
Merge remote-tracking branch 'origin/main'
gkorompi Feb 7, 2025
df932e8
Merge remote-tracking branch 'origin/main'
gkorompi Apr 17, 2025
3fec643
Merge remote-tracking branch 'origin/main'
gkorompi Apr 22, 2025
1d4ed30
Merge remote-tracking branch 'origin/main'
gkorompi Apr 24, 2025
98c3593
Merge remote-tracking branch 'origin/main'
gkorompi May 5, 2025
39cd57f
Merge remote-tracking branch 'origin/main'
gkorompi May 8, 2025
2ff25fd
FIX: path to examples
gkorompi May 14, 2025
55460e7
Merge remote-tracking branch 'origin/main'
gkorompi May 20, 2025
134ef14
Merge remote-tracking branch 'origin/main'
gkorompi May 21, 2025
bea2606
Merge remote-tracking branch 'origin/main'
gkorompi May 22, 2025
d3ebc0f
Merge remote-tracking branch 'origin/main'
gkorompi May 22, 2025
76d8702
Merge remote-tracking branch 'origin/main'
gkorompi Jun 3, 2025
7ddeaea
Merge remote-tracking branch 'origin/main'
gkorompi Jun 26, 2025
aee7cc3
FEATURE: compare_edbs
gkorompi Jun 26, 2025
8a4d3dd
Update src/pyedb/dotnet/edb.py
gkorompi Jun 26, 2025
47575ec
Update tests/legacy/system/test_edb.py
gkorompi Jun 26, 2025
3884b1c
Update src/pyedb/dotnet/edb.py
gkorompi Jun 26, 2025
ab93305
FEATURE: compare_edbs
gkorompi Jun 26, 2025
5b03f09
Merge branch 'main' into compare_edbs
gkorompi Jun 26, 2025
0418826
FEATURE: compare_edbs
gkorompi Jun 26, 2025
819dc86
Merge remote-tracking branch 'origin/compare_edbs' into compare_edbs
gkorompi Jun 26, 2025
c6a92de
FEATURE: compare_edbs
gkorompi Jul 1, 2025
130e319
Merge branch 'main' into compare_edbs
gkorompi Jul 1, 2025
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
34 changes: 34 additions & 0 deletions src/pyedb/dotnet/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4735,3 +4735,37 @@ def get_variable_value(self, variable_name):
return self.variables[variable_name]
else:
return False

def compare(self, input_file, results=""):
"""Compares current open database with another one.

Parameters
----------
input_file : str
Path to the edb file.
results: str, optional
Path to directory in which results will be saved. If no path is given, a new "_compare_results"
directory will be created with the same naming and path as the .aedb folder.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
"""
self.save()
if not results:
results = self.edbpath[:-5] + "_compare_results"
os.mkdir(results)
command = os.path.join(self.base_path, "EDBDiff.exe")
if is_linux:
mono_path = os.path.join(self.base_path, "common/mono/Linux64/bin/mono")
cmd_input = [mono_path, command, input_file, self.edbpath, results]
else:
cmd_input = [command, input_file, self.edbpath, results]
subprocess.run(cmd_input)

if not os.path.exists(os.path.join(results, "EDBDiff.csv")):
self.logger.error("Comparison execution failed")
return False
else:
self.logger.info("Comparison correctly completed")
return True
34 changes: 34 additions & 0 deletions src/pyedb/grpc/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3800,3 +3800,37 @@ def export_gds_comp_xml(self, comps_to_export, gds_comps_unit="mm", control_path
ET.indent(tree, space="\t", level=0)
tree.write(control_path)
return True if os.path.exists(control_path) else False

def compare(self, input_file, results=""):
"""Compares current open database with another one.

Parameters
----------
input_file : str
Path to the edb file.
results: str, optional
Path to directory in which results will be saved. If no path is given, a new "_compare_results"
directory will be created with the same naming and path as the .aedb folder.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
"""
self.save()
if not results:
results = self.edbpath[:-5] + "_compare_results"
os.mkdir(results)
command = os.path.join(self.base_path, "EDBDiff.exe")
if is_linux:
mono_path = os.path.join(self.base_path, "common/mono/Linux64/bin/mono")
cmd_input = [mono_path, command, input_file, self.edbpath, results]
else:
cmd_input = [command, input_file, self.edbpath, results]
subprocess.run(cmd_input)

if not os.path.exists(os.path.join(results, "EDBDiff.csv")):
self.logger.error("Comparison execution failed")
return False
else:
self.logger.info("Comparison correctly completed")
return True
7 changes: 7 additions & 0 deletions tests/grpc/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,3 +1964,10 @@ def test_hfss_get_trace_width_for_traces_with_ports(self, edb_examples):
trace_widths = edbapp.hfss.get_trace_width_for_traces_with_ports()
assert len(trace_widths) > 0
edbapp.close()

def test_compare_edbs(self, edb_examples):
edbapp = edb_examples.get_si_verse()
edb_base = os.path.join(local_path, "example_models", "TEDB", "ANSYS-HSD_V1.aedb")
assert edbapp.compare(edb_base)
folder = edbapp.edbpath[:-5] + "_compare_results"
assert os.path.exists(folder)
7 changes: 7 additions & 0 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,3 +1987,10 @@ def test_hfss_get_trace_width_for_traces_with_ports(self, edb_examples):
trace_widths = edbapp.hfss.get_trace_width_for_traces_with_ports()
assert len(trace_widths) > 0
edbapp.close()

def test_compare_edbs(self, edb_examples):
edbapp = edb_examples.get_si_verse()
edb_base = os.path.join(local_path, "example_models", "TEDB", "ANSYS-HSD_V1.aedb")
assert edbapp.compare(edb_base)
folder = edbapp.edbpath[:-5] + "_compare_results"
assert os.path.exists(folder)
Loading