From 03f411892a876a4decb40c5b9e9cde7cc1fe37ec Mon Sep 17 00:00:00 2001 From: ring630 <@gmail.com> Date: Tue, 28 May 2024 16:01:50 +0200 Subject: [PATCH 1/4] FIX: bug in uniitest --- src/pyedb/configuration/cfg_padstacks.py | 22 ++++++++------- tests/legacy/system/test_edb_config_json.py | 30 +++++++++++++++++++-- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/pyedb/configuration/cfg_padstacks.py b/src/pyedb/configuration/cfg_padstacks.py index 7bf57b719c..a814a9cb3f 100644 --- a/src/pyedb/configuration/cfg_padstacks.py +++ b/src/pyedb/configuration/cfg_padstacks.py @@ -54,20 +54,24 @@ class Definition: def __init__(self, pdata, definition_dict): self._pedb = pdata.pedb self._definition_dict = definition_dict - self.name = self._definition_dict.get("name", "") - self.hole_diameter = self._definition_dict.get("hole_diameter", "") - self.hole_plating_thickness = self._definition_dict.get("hole_plating_thickness", "") - self.hole_material = self._definition_dict.get("hole_material", "") - self.hole_range = self._definition_dict.get("hole_range", "") + self.name = self._definition_dict.get("name", None) + self.hole_diameter = self._definition_dict.get("hole_diameter", None) + self.hole_plating_thickness = self._definition_dict.get("hole_plating_thickness", None) + self.hole_material = self._definition_dict.get("hole_material", None) + self.hole_range = self._definition_dict.get("hole_range", None) def apply(self): """Apply padstack definition on layout.""" padstack_defs = self._pedb.padstacks.definitions pdef = padstack_defs[self.name] - pdef.hole_diameter = self.hole_diameter - pdef.hole_plating_thickness = self.hole_plating_thickness - pdef.material = self.hole_material - pdef.hole_range = self.hole_range + if self.hole_diameter: + pdef.hole_diameter = self.hole_diameter + if self.hole_plating_thickness: + pdef.hole_plating_thickness = self.hole_plating_thickness + if self.hole_material: + pdef.material = self.hole_material + if self.hole_range: + pdef.hole_range = self.hole_range class Instance: diff --git a/tests/legacy/system/test_edb_config_json.py b/tests/legacy/system/test_edb_config_json.py index 3a9195fb0c..2db3774d11 100644 --- a/tests/legacy/system/test_edb_config_json.py +++ b/tests/legacy/system/test_edb_config_json.py @@ -216,8 +216,34 @@ def test_08a_operations_cutout(self, edb_examples): edbapp.close() def test_09_padstacks(self, edb_examples): - with open(self.local_input_folder / "padstacks.json") as f: - data = json.load(f) + data = { + "padstacks": { + "definitions": [ + { + "name": "v40h20", + #"hole_diameter": "0.18mm", + "hole_plating_thickness": "25um", + "hole_material": "copper", + "hole_range": "through" + } + ], + "instances": [ + { + "name": "Via998", + "backdrill_top": { + "drill_to_layer": "Inner3(Sig1)", + "drill_diameter": "0.5mm", + "stub_length": "0.2mm" + }, + "backdrill_bottom": { + "drill_to_layer": "Inner4(Sig2)", + "drill_diameter": "0.5mm", + "stub_length": "0.2mm" + } + } + ] + } + } edbapp = edb_examples.get_si_verse() assert edbapp.configuration.load(data, apply_file=True) From b99d9a97219c6f7b9b1454081ae24ab23b27e1ef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 14:04:03 +0000 Subject: [PATCH 2/4] MISC: Auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci --- tests/legacy/system/test_edb_config_json.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/legacy/system/test_edb_config_json.py b/tests/legacy/system/test_edb_config_json.py index 2db3774d11..907458946b 100644 --- a/tests/legacy/system/test_edb_config_json.py +++ b/tests/legacy/system/test_edb_config_json.py @@ -221,10 +221,10 @@ def test_09_padstacks(self, edb_examples): "definitions": [ { "name": "v40h20", - #"hole_diameter": "0.18mm", + # "hole_diameter": "0.18mm", "hole_plating_thickness": "25um", "hole_material": "copper", - "hole_range": "through" + "hole_range": "through", } ], "instances": [ @@ -233,15 +233,15 @@ def test_09_padstacks(self, edb_examples): "backdrill_top": { "drill_to_layer": "Inner3(Sig1)", "drill_diameter": "0.5mm", - "stub_length": "0.2mm" + "stub_length": "0.2mm", }, "backdrill_bottom": { "drill_to_layer": "Inner4(Sig2)", "drill_diameter": "0.5mm", - "stub_length": "0.2mm" - } + "stub_length": "0.2mm", + }, } - ] + ], } } From eda81c28d0ad54577a581d700141df5154d55bab Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Tue, 28 May 2024 17:56:47 +0200 Subject: [PATCH 3/4] boundaries default behavior --- src/pyedb/configuration/cfg_boundaries.py | 42 +++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/pyedb/configuration/cfg_boundaries.py b/src/pyedb/configuration/cfg_boundaries.py index 67a81b002a..d3b909d7ed 100644 --- a/src/pyedb/configuration/cfg_boundaries.py +++ b/src/pyedb/configuration/cfg_boundaries.py @@ -30,22 +30,22 @@ def __init__(self, pdata, boundaries_dict): self.open_region = self._boundaries_dict.get("open_region", True) self._map_open_region_type() self.pml_visible = self._boundaries_dict.get("pml_visible", False) - self.pml_operation_frequency = self._boundaries_dict.get("pml_operation_frequency", "5GHz") - self.pml_radiation_factor = self._boundaries_dict.get("pml_radiation_factor", 10) + self.pml_operation_frequency = self._boundaries_dict.get("pml_operation_frequency", None) + self.pml_radiation_factor = self._boundaries_dict.get("pml_radiation_factor", None) self._map_dielectric_extend_type() - self.dielectric_base_polygon = self._boundaries_dict.get("dielectric_base_polygon", "") - self.horizontal_padding = self._boundaries_dict.get("horizontal_padding", 0.0) + self.dielectric_base_polygon = self._boundaries_dict.get("dielectric_base_polygon", None) + self.horizontal_padding = self._boundaries_dict.get("horizontal_padding", None) self.honor_primitives_on_dielectric_layers = self._boundaries_dict.get( "honor_primitives_on_dielectric_layers", False ) self._map_air_box_extend_type() - self.air_box_base_polygon = self._boundaries_dict.get("air_box_base_polygon", "") + self.air_box_base_polygon = self._boundaries_dict.get("air_box_base_polygon", None) self.air_box_truncate_model_ground_layers = self._boundaries_dict.get( "air_box_truncate_model_ground_layers", False ) - self.air_box_horizontal_padding = self._boundaries_dict.get("air_box_horizontal_padding", 0.15) - self.air_box_positive_vertical_padding = self._boundaries_dict.get("air_box_positive_vertical_padding", 1) - self.air_box_negative_vertical_padding = self._boundaries_dict.get("air_box_negative_vertical_padding", 1) + self.air_box_horizontal_padding = self._boundaries_dict.get("air_box_horizontal_padding", None) + self.air_box_positive_vertical_padding = self._boundaries_dict.get("air_box_positive_vertical_padding", None) + self.air_box_negative_vertical_padding = self._boundaries_dict.get("air_box_negative_vertical_padding", None) def _map_air_box_extend_type(self): air_box_type = self._boundaries_dict.get("air_box_extents_type", None) @@ -97,19 +97,25 @@ def apply(self): self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.name.lower() self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible - self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency - self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor + if self.pml_operation_frequency: + self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency + if self.pml_radiation_factor: + self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor self._pedb.hfss.hfss_extent_info.extent_type = self.dielectric_extents_type.name.lower() if self.dielectric_base_polygon: self._pedb.hfss.hfss_extent_info.dielectric_base_polygon = self.dielectric_base_polygon - self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding) + if self.horizontal_padding: + self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding) self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extents_type.name.lower() self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers - self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding) - self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float( - self.air_box_positive_vertical_padding - ) - self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float( - self.air_box_negative_vertical_padding - ) + if self.air_box_horizontal_padding: + self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding) + if self.air_box_positive_vertical_padding: + self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float( + self.air_box_positive_vertical_padding + ) + if self.air_box_negative_vertical_padding: + self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float( + self.air_box_negative_vertical_padding + ) From 155fc70864828cb294b205cf768b98afaf07ca8e Mon Sep 17 00:00:00 2001 From: svandenb-dev Date: Tue, 28 May 2024 18:34:54 +0200 Subject: [PATCH 4/4] boundaries default behavior --- src/pyedb/configuration/cfg_boundaries.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pyedb/configuration/cfg_boundaries.py b/src/pyedb/configuration/cfg_boundaries.py index d3b909d7ed..f22920aeaf 100644 --- a/src/pyedb/configuration/cfg_boundaries.py +++ b/src/pyedb/configuration/cfg_boundaries.py @@ -27,9 +27,9 @@ class CfgBoundaries: def __init__(self, pdata, boundaries_dict): self._pedb = pdata.pedb self._boundaries_dict = boundaries_dict - self.open_region = self._boundaries_dict.get("open_region", True) + self.open_region = self._boundaries_dict.get("open_region", None) self._map_open_region_type() - self.pml_visible = self._boundaries_dict.get("pml_visible", False) + self.pml_visible = self._boundaries_dict.get("pml_visible", None) self.pml_operation_frequency = self._boundaries_dict.get("pml_operation_frequency", None) self.pml_radiation_factor = self._boundaries_dict.get("pml_radiation_factor", None) self._map_dielectric_extend_type() @@ -41,7 +41,7 @@ def __init__(self, pdata, boundaries_dict): self._map_air_box_extend_type() self.air_box_base_polygon = self._boundaries_dict.get("air_box_base_polygon", None) self.air_box_truncate_model_ground_layers = self._boundaries_dict.get( - "air_box_truncate_model_ground_layers", False + "air_box_truncate_model_ground_layers", None ) self.air_box_horizontal_padding = self._boundaries_dict.get("air_box_horizontal_padding", None) self.air_box_positive_vertical_padding = self._boundaries_dict.get("air_box_positive_vertical_padding", None) @@ -94,9 +94,11 @@ class ExtentType(Enum): def apply(self): """Imports boundary information from JSON.""" - self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region + if self.open_region is not None: + self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.name.lower() - self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible + if self.pml_visible is not None: + self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible if self.pml_operation_frequency: self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency if self.pml_radiation_factor: @@ -106,9 +108,11 @@ def apply(self): self._pedb.hfss.hfss_extent_info.dielectric_base_polygon = self.dielectric_base_polygon if self.horizontal_padding: self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding) - self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers + if self.honor_primitives_on_dielectric_layers is not None: + self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extents_type.name.lower() - self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers + if self.air_box_truncate_model_ground_layers is not None: + self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers if self.air_box_horizontal_padding: self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding) if self.air_box_positive_vertical_padding: