diff --git a/src/pyedb/configuration/cfg_common.py b/src/pyedb/configuration/cfg_common.py index ee71067cf8..4d7b55d262 100644 --- a/src/pyedb/configuration/cfg_common.py +++ b/src/pyedb/configuration/cfg_common.py @@ -1,4 +1,3 @@ - # Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # diff --git a/src/pyedb/configuration/cfg_modeler.py b/src/pyedb/configuration/cfg_modeler.py index 6d4db2e355..4e961f6e4a 100644 --- a/src/pyedb/configuration/cfg_modeler.py +++ b/src/pyedb/configuration/cfg_modeler.py @@ -20,12 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from pyedb.dotnet.edb_core.edb_data.padstacks_data import ( - EDBPadstack, -) -from pyedb.configuration.cfg_padstacks import CfgPadstackDefinition -from pyedb.configuration.cfg_padstacks import CfgPadstackInstance from pyedb.configuration.cfg_components import CfgComponent +from pyedb.configuration.cfg_padstacks import CfgPadstackDefinition, CfgPadstackInstance +from pyedb.dotnet.edb_core.edb_data.padstacks_data import EDBPadstack class CfgTrace: @@ -59,10 +56,12 @@ class CfgModeler: def __init__(self, pedb, data): self._pedb = pedb self.traces = [CfgTrace(**i) for i in data.get("traces", [])] - self.padstack_defs = [CfgPadstackDefinition(self._pedb, None, **i) for i in - data.get("padstack_definitions", [])] - self.padstack_instances = [CfgPadstackInstance(self._pedb, None, **i) for i in - data.get("padstack_instances", [])] + self.padstack_defs = [ + CfgPadstackDefinition(self._pedb, None, **i) for i in data.get("padstack_definitions", []) + ] + self.padstack_instances = [ + CfgPadstackInstance(self._pedb, None, **i) for i in data.get("padstack_instances", []) + ] self.planes = [CfgPlane(**i) for i in data.get("planes", [])] self.components = [CfgComponent(self._pedb, None, **i) for i in data.get("components", [])] diff --git a/src/pyedb/configuration/cfg_ports_sources.py b/src/pyedb/configuration/cfg_ports_sources.py index 486a3a4cc9..60e2572ec8 100644 --- a/src/pyedb/configuration/cfg_ports_sources.py +++ b/src/pyedb/configuration/cfg_ports_sources.py @@ -20,9 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from pyedb.dotnet.edb_core.general import convert_py_list_to_net_list from pyedb.configuration.cfg_common import CfgBase from pyedb.dotnet.edb_core.edb_data.ports import WavePort +from pyedb.dotnet.edb_core.general import convert_py_list_to_net_list from pyedb.dotnet.edb_core.geometry.point_data import PointData @@ -421,8 +421,9 @@ def __init__(self, pedb, **kwargs): def set_parameters_to_edb(self, edb_primitives): point_on_edge = PointData(self._pedb, x=self.point_on_edge[0], y=self.point_on_edge[1]) primitive = edb_primitives[self.primitive_name] - pos_edge = self._pedb.edb_api.cell.terminal.PrimitiveEdge.Create(primitive._edb_object, - point_on_edge._edb_object) + pos_edge = self._pedb.edb_api.cell.terminal.PrimitiveEdge.Create( + primitive._edb_object, point_on_edge._edb_object + ) pos_edge = convert_py_list_to_net_list(pos_edge, self._pedb.edb_api.cell.terminal.Edge) edge_term = self._pedb.edb_api.cell.terminal.EdgeTerminal.Create( primitive._edb_object.GetLayout(), primitive._edb_object.GetNet(), self.name, pos_edge, isRef=False @@ -448,18 +449,22 @@ def __init__(self, pedb, **kwargs): kwargs["positive_terminal"]["type"] = "wave_port" kwargs["positive_terminal"]["name"] = self.name + ":T1" - self.positive_port = CfgWavePort(self._pedb, - horizontal_extent_factor=self.horizontal_extent_factor, - vertical_extent_factor=self.vertical_extent_factor, - pec_launch_width=self.pec_launch_width, - **kwargs["positive_terminal"]) + self.positive_port = CfgWavePort( + self._pedb, + horizontal_extent_factor=self.horizontal_extent_factor, + vertical_extent_factor=self.vertical_extent_factor, + pec_launch_width=self.pec_launch_width, + **kwargs["positive_terminal"], + ) kwargs["negative_terminal"]["type"] = "wave_port" kwargs["negative_terminal"]["name"] = self.name + ":T2" - self.negative_port = CfgWavePort(self._pedb, - horizontal_extent_factor=self.horizontal_extent_factor, - vertical_extent_factor=self.vertical_extent_factor, - pec_launch_width=self.pec_launch_width, - **kwargs["negative_terminal"]) + self.negative_port = CfgWavePort( + self._pedb, + horizontal_extent_factor=self.horizontal_extent_factor, + vertical_extent_factor=self.vertical_extent_factor, + pec_launch_width=self.pec_launch_width, + **kwargs["negative_terminal"], + ) def set_parameters_to_edb(self, edb_primitives): pos_term = self.positive_port.set_parameters_to_edb(edb_primitives) diff --git a/tests/legacy/system/test_edb_configuration_2p0.py b/tests/legacy/system/test_edb_configuration_2p0.py index f4168d1e37..94bd0e0eb4 100644 --- a/tests/legacy/system/test_edb_configuration_2p0.py +++ b/tests/legacy/system/test_edb_configuration_2p0.py @@ -412,23 +412,31 @@ def test_05f_ports_between_two_points(self, edb_examples): def test_05g_wave_port(self, edb_examples): edbapp = edb_examples.create_empty_edb() edbapp.stackup.create_symmetric_stackup(2) - edbapp.modeler.create_rectangle(layer_name="BOT", net_name="GND", lower_left_point=["-2mm", "-2mm"], - upper_right_point=["2mm", "2mm"]) - prim_1 = edbapp.modeler.create_trace(path_list=([0, 0], [0, "1mm"]), layer_name="TOP", net_name="SIG", - width="0.1mm", - start_cap_style="Flat", end_cap_style="Flat") + edbapp.modeler.create_rectangle( + layer_name="BOT", net_name="GND", lower_left_point=["-2mm", "-2mm"], upper_right_point=["2mm", "2mm"] + ) + prim_1 = edbapp.modeler.create_trace( + path_list=([0, 0], [0, "1mm"]), + layer_name="TOP", + net_name="SIG", + width="0.1mm", + start_cap_style="Flat", + end_cap_style="Flat", + ) prim_1.aedt_name = "path_1" - data = {"ports": [ - { - "name": "wport_1", - "type": "wave_port", - "primitive_name": prim_1.aedt_name, - "point_on_edge": [0, "1mm"], - "horizontal_extent_factor": 6, - "vertical_extent_factor": 4, - "pec_launch_width": "0,2mm" - } - ]} + data = { + "ports": [ + { + "name": "wport_1", + "type": "wave_port", + "primitive_name": prim_1.aedt_name, + "point_on_edge": [0, "1mm"], + "horizontal_extent_factor": 6, + "vertical_extent_factor": 4, + "pec_launch_width": "0,2mm", + } + ] + } edbapp.configuration.load(data, apply_file=True) assert edbapp.ports["wport_1"].horizontal_extent_factor == 6 edbapp.close() @@ -436,31 +444,42 @@ def test_05g_wave_port(self, edb_examples): def test_05h_diff_wave_port(self, edb_examples): edbapp = edb_examples.create_empty_edb() edbapp.stackup.create_symmetric_stackup(2) - edbapp.modeler.create_rectangle(layer_name="BOT", net_name="GND", lower_left_point=["-2mm", "-2mm"], - upper_right_point=["2mm", "2mm"]) - prim_1 = edbapp.modeler.create_trace(path_list=([0, 0], [0, "1mm"]), layer_name="TOP", net_name="SIG", - width="0.1mm", - start_cap_style="Flat", end_cap_style="Flat") + edbapp.modeler.create_rectangle( + layer_name="BOT", net_name="GND", lower_left_point=["-2mm", "-2mm"], upper_right_point=["2mm", "2mm"] + ) + prim_1 = edbapp.modeler.create_trace( + path_list=([0, 0], [0, "1mm"]), + layer_name="TOP", + net_name="SIG", + width="0.1mm", + start_cap_style="Flat", + end_cap_style="Flat", + ) prim_1.aedt_name = "path_1" - prim_2 = edbapp.modeler.create_trace(path_list=(["1mm", 0], ["1mm", "1mm"]), layer_name="TOP", net_name="SIG", - width="0.1mm", - start_cap_style="Flat", end_cap_style="Flat") + prim_2 = edbapp.modeler.create_trace( + path_list=(["1mm", 0], ["1mm", "1mm"]), + layer_name="TOP", + net_name="SIG", + width="0.1mm", + start_cap_style="Flat", + end_cap_style="Flat", + ) prim_2.aedt_name = "path_2" - data = {"ports": [ - { - "name": "diff_wave_1", - "type": "diff_wave_port", - "positive_terminal": {"primitive_name": prim_1.aedt_name, - "point_on_edge": [0, "1mm"]}, - "negative_terminal": {"primitive_name": prim_2.aedt_name, - "point_on_edge": ["1mm", "1mm"]}, - "horizontal_extent_factor": 6, - "vertical_extent_factor": 4, - "pec_launch_width": "0,2mm" - } - ]} + data = { + "ports": [ + { + "name": "diff_wave_1", + "type": "diff_wave_port", + "positive_terminal": {"primitive_name": prim_1.aedt_name, "point_on_edge": [0, "1mm"]}, + "negative_terminal": {"primitive_name": prim_2.aedt_name, "point_on_edge": ["1mm", "1mm"]}, + "horizontal_extent_factor": 6, + "vertical_extent_factor": 4, + "pec_launch_width": "0,2mm", + } + ] + } edbapp.configuration.load(data, apply_file=True) - assert edbapp.ports["diff_wave_1"].horizontal_extent_factor == 6 + assert edbapp.ports["diff_wave_1"].horizontal_extent_factor == 6 edbapp.close() def test_06_s_parameters(self, edb_examples): @@ -1074,10 +1093,17 @@ def test_18_modeler(self, edb_examples): data = { "modeler": { "traces": [ - {"name": "trace_1", "layer": "TOP", "width": "0.1mm", "path": [[0, 0], [0, "10mm"]], - "net_name": "SIG", - "start_cap_style": "flat", "end_cap_style": "flat", "corner_style": "round"}, - {"name": "trace_1_void", "layer": "TOP", "width": "0.3mm", "path": [[0, 0], [0, "10mm"]]} + { + "name": "trace_1", + "layer": "TOP", + "width": "0.1mm", + "path": [[0, 0], [0, "10mm"]], + "net_name": "SIG", + "start_cap_style": "flat", + "end_cap_style": "flat", + "corner_style": "round", + }, + {"name": "trace_1_void", "layer": "TOP", "width": "0.3mm", "path": [[0, 0], [0, "10mm"]]}, ], "padstack_definitions": [ { @@ -1085,48 +1111,76 @@ def test_18_modeler(self, edb_examples): "hole_plating_thickness": "0.025mm", "material": "copper", "pad_parameters": { - 'regular_pad': [ - {'layer_name': 'TOP', 'shape': 'circle', 'offset_x': '0mm', 'offset_y': '0', - 'rotation': '0', - 'diameter': '0.5mm'}, - {'layer_name': 'BOT', 'shape': 'circle', 'offset_x': '0mm', 'offset_y': '0', - 'rotation': '0', - 'diameter': '0.5mm'} + "regular_pad": [ + { + "layer_name": "TOP", + "shape": "circle", + "offset_x": "0mm", + "offset_y": "0", + "rotation": "0", + "diameter": "0.5mm", + }, + { + "layer_name": "BOT", + "shape": "circle", + "offset_x": "0mm", + "offset_y": "0", + "rotation": "0", + "diameter": "0.5mm", + }, ], - 'anti_pad': [ - {'layer_name': 'TOP', 'shape': 'circle', 'offset_x': '0', 'offset_y': '0', - 'rotation': '0', - 'diameter': '1mm'}, - {'layer_name': 'BOT', 'shape': 'circle', 'offset_x': '0', 'offset_y': '0', - 'rotation': '0', - 'diameter': '1mm'} + "anti_pad": [ + { + "layer_name": "TOP", + "shape": "circle", + "offset_x": "0", + "offset_y": "0", + "rotation": "0", + "diameter": "1mm", + }, + { + "layer_name": "BOT", + "shape": "circle", + "offset_x": "0", + "offset_y": "0", + "rotation": "0", + "diameter": "1mm", + }, ], }, "hole_range": "through", "hole_parameters": { "shape": "circle", "diameter": "0.25mm", - } + }, } ], "padstack_instances": [ - {"name": "via_1", - "definition": "via", - "layer_range": ["TOP", "BOT"], - "position": [0, 0], - "net_name": "SIG" - }, - {"name": "pin_1", - "definition": "via", - "layer_range": ["TOP", "TOP"], - "position": [0, "1mm"], - "net_name": "SIG", - "is_pin": True - } + { + "name": "via_1", + "definition": "via", + "layer_range": ["TOP", "BOT"], + "position": [0, 0], + "net_name": "SIG", + }, + { + "name": "pin_1", + "definition": "via", + "layer_range": ["TOP", "TOP"], + "position": [0, "1mm"], + "net_name": "SIG", + "is_pin": True, + }, ], "planes": [ - {"name": "GND_TOP", "layer": "TOP", "net_name": "GND", "lower_left_point": [0, 0], - "upper_right_point": [0, "12mm"], "voids": ["trace_1_void"]}, + { + "name": "GND_TOP", + "layer": "TOP", + "net_name": "GND", + "lower_left_point": [0, 0], + "upper_right_point": [0, "12mm"], + "voids": ["trace_1_void"], + }, ], "components": [ { @@ -1143,7 +1197,7 @@ def test_18_modeler(self, edb_examples): "reference_size_y": 0, }, }, - ] + ], } } edbapp = edb_examples.create_empty_edb() @@ -1159,7 +1213,7 @@ def test_19_variables(self, edb_examples): data = { "variables": [ {"name": "var_1", "value": "1mm", "description": "No description"}, - {"name": "$var_2", "value": "1mm", "description": "No description"} + {"name": "$var_2", "value": "1mm", "description": "No description"}, ] } edbapp = edb_examples.create_empty_edb()