Skip to content

Commit

Permalink
MISC: Auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 29, 2024
1 parent 31e1a9f commit dfe32ca
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 97 deletions.
1 change: 0 additions & 1 deletion src/pyedb/configuration/cfg_common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
Expand Down
17 changes: 8 additions & 9 deletions src/pyedb/configuration/cfg_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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", [])]

Expand Down
31 changes: 18 additions & 13 deletions src/pyedb/configuration/cfg_ports_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
202 changes: 128 additions & 74 deletions tests/legacy/system/test_edb_configuration_2p0.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,55 +412,74 @@ 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()

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):
Expand Down Expand Up @@ -1074,59 +1093,94 @@ 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": [
{
"name": "via",
"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": [
{
Expand All @@ -1143,7 +1197,7 @@ def test_18_modeler(self, edb_examples):
"reference_size_y": 0,
},
},
]
],
}
}
edbapp = edb_examples.create_empty_edb()
Expand All @@ -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()
Expand Down

0 comments on commit dfe32ca

Please sign in to comment.