pyedb 0.56.0__py3-none-any.whl → 0.58.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (110) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_data.py +3 -0
  3. pyedb/configuration/cfg_pin_groups.py +2 -0
  4. pyedb/configuration/cfg_terminals.py +232 -0
  5. pyedb/configuration/configuration.py +146 -3
  6. pyedb/dotnet/clr_module.py +1 -2
  7. pyedb/dotnet/database/Variables.py +30 -22
  8. pyedb/dotnet/database/cell/hierarchy/component.py +2 -8
  9. pyedb/dotnet/database/cell/layout.py +5 -1
  10. pyedb/dotnet/database/cell/primitive/primitive.py +2 -2
  11. pyedb/dotnet/database/cell/terminal/bundle_terminal.py +12 -0
  12. pyedb/dotnet/database/cell/terminal/pingroup_terminal.py +1 -1
  13. pyedb/dotnet/database/cell/terminal/terminal.py +38 -0
  14. pyedb/dotnet/database/components.py +15 -19
  15. pyedb/dotnet/database/dotnet/database.py +1 -0
  16. pyedb/dotnet/database/edb_data/control_file.py +19 -8
  17. pyedb/dotnet/database/edb_data/nets_data.py +3 -3
  18. pyedb/dotnet/database/edb_data/padstacks_data.py +39 -14
  19. pyedb/dotnet/database/edb_data/ports.py +0 -25
  20. pyedb/dotnet/database/edb_data/primitives_data.py +3 -3
  21. pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py +18 -19
  22. pyedb/dotnet/database/edb_data/simulation_configuration.py +3 -3
  23. pyedb/dotnet/database/edb_data/sources.py +21 -2
  24. pyedb/dotnet/database/general.py +1 -6
  25. pyedb/dotnet/database/hfss.py +9 -8
  26. pyedb/dotnet/database/layout_validation.py +14 -3
  27. pyedb/dotnet/database/materials.py +1 -3
  28. pyedb/dotnet/database/modeler.py +7 -3
  29. pyedb/dotnet/database/nets.py +27 -19
  30. pyedb/dotnet/database/padstack.py +4 -2
  31. pyedb/dotnet/database/sim_setup_data/io/siwave.py +54 -1
  32. pyedb/dotnet/database/siwave.py +4 -3
  33. pyedb/dotnet/database/stackup.py +55 -58
  34. pyedb/dotnet/database/utilities/heatsink.py +0 -1
  35. pyedb/dotnet/database/utilities/hfss_simulation_setup.py +81 -0
  36. pyedb/dotnet/database/utilities/simulation_setup.py +7 -5
  37. pyedb/dotnet/database/utilities/siwave_cpa_simulation_setup.py +1 -0
  38. pyedb/dotnet/database/utilities/siwave_simulation_setup.py +264 -13
  39. pyedb/dotnet/edb.py +65 -47
  40. pyedb/exceptions.py +1 -2
  41. pyedb/extensions/create_cell_array.py +67 -49
  42. pyedb/generic/data_handlers.py +13 -23
  43. pyedb/generic/design_types.py +9 -35
  44. pyedb/generic/filesystem.py +4 -2
  45. pyedb/generic/general_methods.py +28 -41
  46. pyedb/generic/plot.py +8 -23
  47. pyedb/generic/process.py +78 -10
  48. pyedb/grpc/database/_typing.py +0 -0
  49. pyedb/grpc/database/components.py +14 -13
  50. pyedb/grpc/database/control_file.py +27 -40
  51. pyedb/grpc/database/definition/materials.py +1 -1
  52. pyedb/grpc/database/definition/package_def.py +6 -3
  53. pyedb/grpc/database/definition/padstack_def.py +14 -12
  54. pyedb/grpc/database/hfss.py +1 -4
  55. pyedb/grpc/database/hierarchy/component.py +5 -13
  56. pyedb/grpc/database/hierarchy/pingroup.py +16 -3
  57. pyedb/grpc/database/layers/layer.py +1 -2
  58. pyedb/grpc/database/layers/stackup_layer.py +42 -19
  59. pyedb/grpc/database/layout/layout.py +43 -27
  60. pyedb/grpc/database/layout/voltage_regulator.py +6 -1
  61. pyedb/grpc/database/layout_validation.py +5 -2
  62. pyedb/grpc/database/modeler.py +254 -252
  63. pyedb/grpc/database/net/differential_pair.py +9 -2
  64. pyedb/grpc/database/net/extended_net.py +24 -9
  65. pyedb/grpc/database/net/net.py +14 -5
  66. pyedb/grpc/database/net/net_class.py +24 -7
  67. pyedb/grpc/database/nets.py +11 -43
  68. pyedb/grpc/database/padstacks.py +67 -119
  69. pyedb/grpc/database/primitive/bondwire.py +3 -67
  70. pyedb/grpc/database/primitive/circle.py +42 -3
  71. pyedb/grpc/database/primitive/padstack_instance.py +58 -31
  72. pyedb/grpc/database/primitive/path.py +160 -11
  73. pyedb/grpc/database/primitive/polygon.py +73 -7
  74. pyedb/grpc/database/primitive/primitive.py +2 -2
  75. pyedb/grpc/database/primitive/rectangle.py +105 -4
  76. pyedb/grpc/database/simulation_setup/hfss_general_settings.py +0 -2
  77. pyedb/grpc/database/simulation_setup/hfss_settings_options.py +0 -4
  78. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +79 -0
  79. pyedb/grpc/database/simulation_setup/siwave_cpa_simulation_setup.py +1 -0
  80. pyedb/grpc/database/simulation_setup/sweep_data.py +1 -3
  81. pyedb/grpc/database/siwave.py +6 -13
  82. pyedb/grpc/database/source_excitations.py +46 -63
  83. pyedb/grpc/database/stackup.py +55 -60
  84. pyedb/grpc/database/terminal/bundle_terminal.py +10 -3
  85. pyedb/grpc/database/terminal/padstack_instance_terminal.py +9 -11
  86. pyedb/grpc/database/terminal/pingroup_terminal.py +8 -1
  87. pyedb/grpc/database/terminal/point_terminal.py +30 -0
  88. pyedb/grpc/database/terminal/terminal.py +35 -10
  89. pyedb/grpc/database/utility/heat_sink.py +0 -1
  90. pyedb/grpc/database/utility/hfss_extent_info.py +2 -2
  91. pyedb/grpc/database/utility/xml_control_file.py +19 -8
  92. pyedb/grpc/edb.py +63 -32
  93. pyedb/grpc/edb_init.py +1 -0
  94. pyedb/ipc2581/ecad/cad_data/layer_feature.py +6 -2
  95. pyedb/ipc2581/ecad/cad_data/step.py +1 -1
  96. pyedb/ipc2581/ipc2581.py +8 -7
  97. pyedb/libraries/common.py +3 -4
  98. pyedb/libraries/rf_libraries/base_functions.py +7 -16
  99. pyedb/libraries/rf_libraries/planar_antennas.py +3 -21
  100. pyedb/misc/aedtlib_personalib_install.py +2 -2
  101. pyedb/misc/downloads.py +19 -3
  102. pyedb/misc/misc.py +5 -2
  103. pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +3 -2
  104. pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py +0 -1
  105. pyedb/misc/utilities.py +0 -1
  106. pyedb/modeler/geometry_operators.py +3 -2
  107. {pyedb-0.56.0.dist-info → pyedb-0.58.0.dist-info}/METADATA +6 -7
  108. {pyedb-0.56.0.dist-info → pyedb-0.58.0.dist-info}/RECORD +110 -108
  109. {pyedb-0.56.0.dist-info → pyedb-0.58.0.dist-info}/WHEEL +0 -0
  110. {pyedb-0.56.0.dist-info → pyedb-0.58.0.dist-info}/licenses/LICENSE +0 -0
@@ -21,11 +21,14 @@
21
21
  # SOFTWARE.
22
22
 
23
23
 
24
+ from typing import Union
25
+
24
26
  from ansys.edb.core.primitive.rectangle import (
27
+ Rectangle as GrpcRectangle,
25
28
  RectangleRepresentationType as GrpcRectangleRepresentationType,
26
29
  )
27
- from ansys.edb.core.primitive.rectangle import Rectangle as GrpcRectangle
28
30
 
31
+ from pyedb.grpc.database.layers.layer import Layer
29
32
  from pyedb.grpc.database.primitive.primitive import Primitive
30
33
  from pyedb.grpc.database.utility.value import Value
31
34
 
@@ -33,9 +36,10 @@ from pyedb.grpc.database.utility.value import Value
33
36
  class Rectangle(GrpcRectangle, Primitive):
34
37
  """Class representing a rectangle object."""
35
38
 
36
- def __init__(self, pedb, edb_object):
37
- Primitive.__init__(self, pedb, edb_object)
38
- GrpcRectangle.__init__(self, edb_object.msg)
39
+ def __init__(self, pedb, edb_object=None):
40
+ if edb_object:
41
+ Primitive.__init__(self, pedb, edb_object)
42
+ GrpcRectangle.__init__(self, edb_object.msg)
39
43
  self._pedb = pedb
40
44
  self._mapping_representation_type = {
41
45
  "center_width_height": GrpcRectangleRepresentationType.CENTER_WIDTH_HEIGHT,
@@ -71,6 +75,103 @@ class Rectangle(GrpcRectangle, Primitive):
71
75
  else:
72
76
  super().representation_type = self._mapping_representation_type[value]
73
77
 
78
+ def create(
79
+ self,
80
+ layout=None,
81
+ layer: Union[str, Layer] = None,
82
+ net: Union[str, "Net"] = None,
83
+ rep_type: str = "center_width_height",
84
+ param1: float = None,
85
+ param2: float = None,
86
+ param3: float = None,
87
+ param4: float = None,
88
+ corner_rad: float = 0.0,
89
+ rotation: float = 0.0,
90
+ ):
91
+ """
92
+ Create a rectangle primitive in the specified layout, layer, and net with the given parameters.
93
+
94
+ Parameters
95
+ ----------
96
+ layout : Layout, optional
97
+ The layout in which the rectangle will be created. If not provided, the active layout of the `pedb` instance
98
+ will be used.
99
+ layer : Union[str, Layer], optional
100
+ The layer in which the rectangle will be created. This parameter is required and must be specified.
101
+ net : Union[str, Net], optional
102
+ The net to which the rectangle will belong. This parameter is required and must be specified.
103
+ rep_type : str, optional
104
+ The representation type of the rectangle. Options are `"center_width_height"` or `"lower_left_upper_right"`.
105
+ The default value is `"center_width_height"`.
106
+ param1 : float, optional
107
+ The first parameter defining the rectangle. Its meaning depends on the `rep_type`.
108
+ param2 : float, optional
109
+ The second parameter defining the rectangle. Its meaning depends on the `rep_type`.
110
+ param3 : float, optional
111
+ The third parameter defining the rectangle. Its meaning depends on the `rep_type`.
112
+ param4 : float, optional
113
+ The fourth parameter defining the rectangle. Its meaning depends on the `rep_type`.
114
+ corner_rad : float, optional
115
+ The corner radius of the rectangle. The default value is `0.0`.
116
+ rotation : float, optional
117
+ The rotation angle of the rectangle in degrees. The default value is `0.0`.
118
+
119
+ Returns
120
+ -------
121
+ Rectangle
122
+ The created rectangle primitive.
123
+
124
+ Raises
125
+ ------
126
+ ValueError
127
+ If the `layer` parameter is not provided.
128
+ ValueError
129
+ If the `net` parameter is not provided.
130
+
131
+ Notes
132
+ -----
133
+ - The created rectangle is added to the modeler primitives of the `pedb` instance.
134
+ - The `rep_type` determines how the parameters are interpreted:
135
+ - `"center_width_height"`: `param1` and `param2` represent the center coordinates, while `param3` and
136
+ `param4` represent the width and height.
137
+ - `"lower_left_upper_right"`: `param1` and `param2` represent the lower-left corner coordinates, while
138
+ `param3` and `param4` represent the upper-right corner coordinates.
139
+ """
140
+ if not layout:
141
+ layout = self._pedb.active_layout
142
+ if not layer:
143
+ raise ValueError("Layer must be provided.")
144
+ if not net:
145
+ raise ValueError("Net must be provided.")
146
+
147
+ rep_type_mapping = {
148
+ "center_width_height": GrpcRectangleRepresentationType.CENTER_WIDTH_HEIGHT,
149
+ "lower_left_upper_right": GrpcRectangleRepresentationType.LOWER_LEFT_UPPER_RIGHT,
150
+ }
151
+ rep_type = rep_type_mapping.get(rep_type, GrpcRectangleRepresentationType.INVALID_RECT_TYPE)
152
+ edb_object = super().create(
153
+ layout=layout,
154
+ layer=layer,
155
+ net=net,
156
+ rep_type=rep_type,
157
+ param1=Value(param1),
158
+ param2=Value(param2),
159
+ param3=Value(param3),
160
+ param4=Value(param4),
161
+ corner_rad=Value(corner_rad),
162
+ rotation=Value(rotation),
163
+ )
164
+ # keep cache synced
165
+ new_rect = Rectangle(self._pedb, edb_object)
166
+ self._pedb.modeler._add_primitive(new_rect)
167
+ return new_rect
168
+
169
+ def delete(self):
170
+ """Delete the rectangle primitive from the layout."""
171
+ # Remove from cache
172
+ self._pedb.modeler._remove_primitive(self)
173
+ super().delete()
174
+
74
175
  def get_parameters(self):
75
176
  """Get coordinates parameters.
76
177
 
@@ -23,8 +23,6 @@
23
23
 
24
24
  from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
25
25
  AdaptType as GrpcAdaptType,
26
- )
27
- from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
28
26
  HFSSGeneralSettings as GrpcHFSSGeneralSettings,
29
27
  )
30
28
 
@@ -23,11 +23,7 @@
23
23
 
24
24
  from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
25
25
  BasisFunctionOrder as GrpcBasisFunctionOrder,
26
- )
27
- from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
28
26
  HFSSSettingsOptions as GrpcHFSSSettingsOptions,
29
- )
30
- from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
31
27
  SolverType as GrpcSolverType,
32
28
  )
33
29
 
@@ -30,6 +30,7 @@ from ansys.edb.core.simulation_setup.hfss_simulation_settings import (
30
30
  from ansys.edb.core.simulation_setup.hfss_simulation_setup import (
31
31
  HfssSimulationSetup as GrpcHfssSimulationSetup,
32
32
  )
33
+ from ansys.edb.core.simulation_setup.mesh_operation import LengthMeshOperation as GrpcLengthMeshOperation
33
34
 
34
35
  from pyedb.generic.general_methods import generate_unique_name
35
36
  from pyedb.grpc.database.simulation_setup.sweep_data import SweepData
@@ -411,3 +412,81 @@ class HfssSimulationSetup(GrpcHfssSimulationSetup):
411
412
  else:
412
413
  self._pedb.logger.error("Failed to add frequency sweep data")
413
414
  return False
415
+
416
+ def auto_mesh_operation(
417
+ self,
418
+ trace_ratio_seeding: float = 3,
419
+ signal_via_side_number: int = 12,
420
+ power_ground_via_side_number: int = 6,
421
+ ) -> bool:
422
+ """
423
+ Automatically create and apply a length-based mesh operation for all nets in the design.
424
+
425
+ The method inspects every signal net, determines the smallest trace width, and
426
+ seeds a :class:`GrpcLengthMeshOperation` whose maximum element length is
427
+ ``smallest_width * trace_ratio_seeding``. Signal vias (padstack instances) are
428
+ configured with the requested number of polygon sides, while power/ground vias
429
+ are updated through the global ``num_via_sides`` advanced setting.
430
+
431
+ Parameters
432
+ ----------
433
+ trace_ratio_seeding : float, optional
434
+ Ratio used to compute the maximum allowed element length from the
435
+ smallest trace width found in the design. The resulting length is
436
+ ``min_width * trace_ratio_seeding``. Defaults to ``3``.
437
+ signal_via_side_number : int, optional
438
+ Number of sides (i.e. faceting resolution) assigned to **signal**
439
+ padstack instances that belong to the nets being meshed.
440
+ Defaults to ``12``.
441
+ power_ground_via_side_number : int, optional
442
+ Number of sides assigned to **power/ground** vias via the global
443
+ ``advanced.num_via_sides`` setting. Defaults to ``6``.
444
+
445
+ Returns
446
+ -------
447
+ bool
448
+
449
+ Raises
450
+ ------
451
+ ValueError
452
+ If the design contains no terminals, making mesh seeding impossible.
453
+
454
+ Notes
455
+ -----
456
+ * Only primitives of type ``"path"`` are considered when determining the
457
+ smallest trace width.
458
+ * Every ``(net, layer, sheet)`` tuple required by the mesher is
459
+ automatically populated; sheet are explicitly marked as ``False``.
460
+ * Existing contents of :attr:`mesh_operations` are **replaced** by the
461
+ single new operation.
462
+
463
+ Examples
464
+ --------
465
+ >>> setup = edbapp.setups["my_setup"]
466
+ >>> setup.auto_mesh_operation(trace_ratio_seeding=4, signal_via_side_number=16)
467
+ >>> setup.mesh_operations[0].max_length
468
+ '2.5um'
469
+ """
470
+ net_for_mesh_seeding = list(set([term.net.name for term in list(self._pedb.terminals.values())]))
471
+ if not net_for_mesh_seeding:
472
+ raise ValueError("No terminals found to seed the mesh operation.")
473
+ meshop = GrpcLengthMeshOperation(name=f"{self.name}_AutoMeshOp")
474
+ layer_info = []
475
+ smallest_width = 1e3
476
+ for net in net_for_mesh_seeding:
477
+ traces = [prim for prim in self._pedb.modeler.primitives_by_net[net] if prim.type == "path"]
478
+ _width = min([trace.width for trace in traces], default=1e3)
479
+ if _width < smallest_width:
480
+ smallest_width = _width
481
+ layers = list(set([trace.layer.name for trace in traces]))
482
+ for layer in layers:
483
+ layer_info.append((net, layer, False))
484
+ for inst in self._pedb.padstacks.instances_by_net[net]:
485
+ inst.side_number = signal_via_side_number
486
+ meshop.max_length = f"{round(float((smallest_width * trace_ratio_seeding)), 9) * 1e6}um"
487
+ meshop.net_layer_info = layer_info
488
+ self.mesh_operations = [meshop]
489
+ self.settings.advanced.num_via_sides = power_ground_via_side_number
490
+ if self.mesh_operations:
491
+ return True
492
+ return False
@@ -758,6 +758,7 @@ class SIWaveCPASimulationSetup:
758
758
  self._pedb = pedb
759
759
  self._channel_setup = ChannelSetup(pedb)
760
760
  self._solver_options = SolverOptions(pedb)
761
+ self.type = "cpa"
761
762
  if isinstance(siwave_cpa_setup_class, SIwaveCpaSetup):
762
763
  self._apply_cfg_object(siwave_cpa_setup_class)
763
764
  else:
@@ -22,11 +22,9 @@
22
22
 
23
23
  from ansys.edb.core.simulation_setup.simulation_setup import (
24
24
  Distribution as GrpcDistribution,
25
- )
26
- from ansys.edb.core.simulation_setup.simulation_setup import (
27
25
  FrequencyData as GrpcFrequencyData,
26
+ SweepData as GrpcSweepData,
28
27
  )
29
- from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData
30
28
 
31
29
 
32
30
  class SweepData(GrpcSweepData):
@@ -24,6 +24,7 @@
24
24
  This module contains these classes: ``CircuitPort``, ``CurrentSource``, ``EdbSiwave``,
25
25
  ``PinGroup``, ``ResistorSource``, ``Source``, ``SourceType``, and ``VoltageSource``.
26
26
  """
27
+
27
28
  import os
28
29
  from typing import Any, Dict, Optional, Union
29
30
  import warnings
@@ -31,11 +32,9 @@ import warnings
31
32
  from ansys.edb.core.database import ProductIdType as GrpcProductIdType
32
33
  from ansys.edb.core.simulation_setup.simulation_setup import (
33
34
  Distribution as GrpcDistribution,
34
- )
35
- from ansys.edb.core.simulation_setup.simulation_setup import (
36
35
  FrequencyData as GrpcFrequencyData,
36
+ SweepData as GrpcSweepData,
37
37
  )
38
- from ansys.edb.core.simulation_setup.simulation_setup import SweepData as GrpcSweepData
39
38
 
40
39
  from pyedb.grpc.database.simulation_setup.siwave_cpa_simulation_setup import (
41
40
  SIWaveCPASimulationSetup,
@@ -335,7 +334,7 @@ class Siwave(object):
335
334
  Use :func:`pyedb.grpc.core.excitations._check_gnd` instead.
336
335
  """
337
336
  warnings.warn(
338
- "`_check_gnd` is deprecated and is now located here " "`pyedb.grpc.core.excitations._check_gnd` instead.",
337
+ "`_check_gnd` is deprecated and is now located here `pyedb.grpc.core.excitations._check_gnd` instead.",
339
338
  DeprecationWarning,
340
339
  )
341
340
  return self._pedb.source_excitation._check_gnd(component_name)
@@ -563,9 +562,7 @@ class Siwave(object):
563
562
  >>> success = edbapp.siwave.create_exec_file(add_ac=True, add_syz=True)
564
563
  >>> # Create exec file with Touchstone export
565
564
  >>> success = edbapp.siwave.create_exec_file(
566
- ... add_ac=True,
567
- ... export_touchstone=True,
568
- ... touchstone_file_path="C:/temp/my_touchstone.s2p"
565
+ ... add_ac=True, export_touchstone=True, touchstone_file_path="C:/temp/my_touchstone.s2p"
569
566
  ... )
570
567
  """
571
568
  workdir = os.path.dirname(self._pedb.edbpath)
@@ -644,17 +641,13 @@ class Siwave(object):
644
641
  >>> from pyedb import Edb
645
642
  >>> edbapp = Edb("myaedbfolder", edbversion="2021.2")
646
643
  >>> # Add SYZ analysis with linear sweep from 1kHz to 10GHz
647
- >>> setup = edbapp.siwave.add_siwave_syz_analysis(
648
- ... start_freq=1e3,
649
- ... stop_freq=10e9,
650
- ... distribution="linear"
651
- ... )
644
+ >>> setup = edbapp.siwave.add_siwave_syz_analysis(start_freq=1e3, stop_freq=10e9, distribution="linear")
652
645
  >>> # Add SYZ analysis with decade sweep
653
646
  >>> setup = edbapp.siwave.add_siwave_syz_analysis(
654
647
  ... start_freq=1e3,
655
648
  ... stop_freq=10e9,
656
649
  ... distribution="decade_count",
657
- ... step_freq=10 # 10 points per decade
650
+ ... step_freq=10, # 10 points per decade
658
651
  ... )
659
652
  """
660
653
  setup = self._pedb.create_siwave_syz_setup()
@@ -25,8 +25,7 @@ from typing import Any, Dict, List, Optional, Set, Tuple, Union
25
25
  from ansys.edb.core.database import ProductIdType as GrpcProductIdType
26
26
  from ansys.edb.core.geometry.point_data import PointData as GrpcPointData
27
27
  from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData
28
- from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal
29
- from ansys.edb.core.terminal.edge_terminal import PrimitiveEdge as GrpcPrimitiveEdge
28
+ from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTerminal, PrimitiveEdge as GrpcPrimitiveEdge
30
29
  from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
31
30
  from ansys.edb.core.utility.rlc import Rlc as GrpcRlc
32
31
 
@@ -66,14 +65,14 @@ class SourceExcitation:
66
65
  >>> # Create voltage source on component pins
67
66
  >>> from pyedb.grpc.database.utility.sources import Source, SourceType
68
67
  >>> source = Source(
69
- >>> source_type=SourceType.Vsource,
70
- >>> name="V1",
71
- >>> positive_node=("U1", "VCC"),
72
- >>> negative_node=("U1", "GND"),
73
- >>> amplitude="1V",
74
- >>> phase="0deg",
75
- >>> impedance="50ohm"
76
- >>> )
68
+ ... source_type=SourceType.Vsource,
69
+ ... name="V1",
70
+ ... positive_node=("U1", "VCC"),
71
+ ... negative_node=("U1", "GND"),
72
+ ... amplitude="1V",
73
+ ... phase="0deg",
74
+ ... impedance="50ohm",
75
+ ... )
77
76
  >>> source_excitations.create_source_on_component([source])
78
77
 
79
78
  >>> # 2. create_port
@@ -85,21 +84,14 @@ class SourceExcitation:
85
84
  >>> # 3. create_port_on_pins
86
85
  >>> # Create circuit port between component pins
87
86
  >>> port_term = source_excitations.create_port_on_pins(
88
- >>> refdes="U1",
89
- >>> pins="Pin1",
90
- >>> reference_pins=["GND_Pin1", "GND_Pin2"],
91
- >>> impedance=50,
92
- >>> port_name="Port1"
93
- >>> )
87
+ ... refdes="U1", pins="Pin1", reference_pins=["GND_Pin1", "GND_Pin2"], impedance=50, port_name="Port1"
88
+ ... )
94
89
 
95
90
  >>> # 4. create_port_on_component
96
91
  >>> # Create coaxial ports on component nets
97
92
  >>> source_excitations.create_port_on_component(
98
- >>> component="U1",
99
- >>> net_list=["PCIe_RX0", "PCIe_RX1"],
100
- >>> port_type=SourceType.CoaxPort,
101
- >>> reference_net="GND"
102
- >>> )
93
+ ... component="U1", net_list=["PCIe_RX0", "PCIe_RX1"], port_type=SourceType.CoaxPort, reference_net="GND"
94
+ ... )
103
95
 
104
96
  >>> # 5. add_port_on_rlc_component
105
97
  >>> # Replace RLC component with circuit port
@@ -153,35 +145,26 @@ class SourceExcitation:
153
145
  >>> # 16. create_coax_port_on_component
154
146
  >>> # Create coaxial ports on component
155
147
  >>> ports = source_excitations.create_coax_port_on_component(
156
- >>> ["U1", "U2"],
157
- >>> ["PCIe_RX0", "PCIe_TX0"],
158
- >>> delete_existing_terminal=True
159
- >>> )
148
+ ... ["U1", "U2"], ["PCIe_RX0", "PCIe_TX0"], delete_existing_terminal=True
149
+ ... )
160
150
 
161
151
  >>> # 17. create_differential_wave_port
162
152
  >>> # Create differential wave port
163
153
  >>> pos_prim = edb.modeler.primitives[0]
164
154
  >>> neg_prim = edb.modeler.primitives[1]
165
155
  >>> port_name, diff_port = source_excitations.create_differential_wave_port(
166
- >>> pos_prim.id, [0, 0],
167
- >>> neg_prim.id, [0, 0.2],
168
- >>> "DiffPort"
169
- >>> )
156
+ ... pos_prim.id, [0, 0], neg_prim.id, [0, 0.2], "DiffPort"
157
+ ... )
170
158
 
171
159
  >>> # 18. create_wave_port
172
160
  >>> # Create wave port
173
- >>> port_name, wave_port = source_excitations.create_wave_port(
174
- >>> pos_prim.id, [0, 0],
175
- >>> "WavePort"
176
- >>> )
161
+ >>> port_name, wave_port = source_excitations.create_wave_port(pos_prim.id, [0, 0], "WavePort")
177
162
 
178
163
  >>> # 19. create_bundle_wave_port
179
164
  >>> # Create bundle wave port
180
165
  >>> port_name, bundle_port = source_excitations.create_bundle_wave_port(
181
- >>> [pos_prim.id, neg_prim.id],
182
- >>> [[0,0], [0,0.2]],
183
- >>> "BundlePort"
184
- >>> )
166
+ ... [pos_prim.id, neg_prim.id], [[0, 0], [0, 0.2]], "BundlePort"
167
+ ... )
185
168
 
186
169
  >>> # 20. create_dc_terminal
187
170
  >>> # Create DC terminal
@@ -194,10 +177,8 @@ class SourceExcitation:
194
177
  >>> # 22. place_voltage_probe
195
178
  >>> # Place voltage probe between points
196
179
  >>> source_excitations.place_voltage_probe(
197
- >>> "Probe1",
198
- >>> "SignalNet", [0, 0], "TopLayer",
199
- >>> "GND", [0.1, 0.1], "BottomLayer"
200
- >>> )
180
+ ... "Probe1", "SignalNet", [0, 0], "TopLayer", "GND", [0.1, 0.1], "BottomLayer"
181
+ ... )
201
182
 
202
183
  >>> # Save and close EDB
203
184
  >>> edb.save()
@@ -505,22 +486,22 @@ class SourceExcitation:
505
486
 
506
487
  def create_port_on_component(
507
488
  self,
508
- component: Union[str, List[str]],
489
+ component: Union[str, Component],
509
490
  net_list: Union[str, List[str]],
510
- port_type: SourceType,
491
+ port_type: str = "coax_port",
511
492
  do_pingroup: Optional[bool] = True,
512
493
  reference_net: Optional[str] = None,
513
494
  port_name: Optional[List[str]] = None,
514
- solder_balls_height: Optional[float] = None,
515
- solder_balls_size: Optional[float] = None,
516
- solder_balls_mid_size: Optional[float] = None,
495
+ solder_balls_height: Union[float, str] = None,
496
+ solder_balls_size: Union[float, str] = None,
497
+ solder_balls_mid_size: Union[float, str] = None,
517
498
  extend_reference_pins_outside_component: Optional[bool] = False,
518
499
  ) -> List[str]:
519
500
  """Create ports on a component.
520
501
 
521
502
  Parameters
522
503
  ----------
523
- component : str or self._pedb.component
504
+ component : str or Component
524
505
  EDB component or str component name.
525
506
  net_list : str or list of string.
526
507
  List of nets where ports must be created on the component.
@@ -584,8 +565,11 @@ class SourceExcitation:
584
565
  net_name = net.name
585
566
  if net_name:
586
567
  net_list.append(net_name)
587
- except:
588
- pass
568
+ except Exception as e:
569
+ self._logger.warning(
570
+ f"A(n) {type(e).__name__} error occurred while attempting to append 'name' "
571
+ f"of net {net} to list of nets {net_list}: {str(e)}"
572
+ )
589
573
  if isinstance(reference_net, str) or isinstance(reference_net, Net):
590
574
  reference_net = [reference_net]
591
575
  _reference_net = [ref.name for ref in reference_net if isinstance(ref, Net)]
@@ -1656,8 +1640,7 @@ class SourceExcitation:
1656
1640
 
1657
1641
  if not source_name:
1658
1642
  source_name = (
1659
- f"Vsource_{positive_component_name}_{positive_net_name}_"
1660
- f"{negative_component_name}_{negative_net_name}"
1643
+ f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}"
1661
1644
  )
1662
1645
  return self.create_pin_group_terminal(
1663
1646
  positive_pins=pos_node_pins,
@@ -1720,8 +1703,7 @@ class SourceExcitation:
1720
1703
 
1721
1704
  if not source_name:
1722
1705
  source_name = (
1723
- f"Vsource_{positive_component_name}_{positive_net_name}_"
1724
- f"{negative_component_name}_{negative_net_name}"
1706
+ f"Vsource_{positive_component_name}_{positive_net_name}_{negative_component_name}_{negative_net_name}"
1725
1707
  )
1726
1708
  return self.create_pin_group_terminal(
1727
1709
  positive_pins=pos_node_pins,
@@ -1865,7 +1847,7 @@ class SourceExcitation:
1865
1847
  --------
1866
1848
  >>> from pyedb import Edb
1867
1849
  >>> edb = Edb()
1868
- >>> port_name, port = edb.source_excitation.create_differential_wave_port(0, [0,0], 1, [0,0.2])
1850
+ >>> port_name, port = edb.source_excitation.create_differential_wave_port(0, [0, 0], 1, [0, 0.2])
1869
1851
  """
1870
1852
  if not port_name:
1871
1853
  port_name = generate_unique_name("diff")
@@ -1939,7 +1921,7 @@ class SourceExcitation:
1939
1921
  --------
1940
1922
  >>> from pyedb import Edb
1941
1923
  >>> edb = Edb()
1942
- >>> port_name, port = edb.source_excitation.create_wave_port(0, [0,0])
1924
+ >>> port_name, port = edb.source_excitation.create_wave_port(0, [0, 0])
1943
1925
  """
1944
1926
  if not port_name:
1945
1927
  port_name = generate_unique_name("Terminal_")
@@ -2007,7 +1989,7 @@ class SourceExcitation:
2007
1989
  --------
2008
1990
  >>> from pyedb import Edb
2009
1991
  >>> edb = Edb()
2010
- >>> term = edb.source_excitation.create_edge_port_vertical(0, [0,0], reference_layer="TopLayer")
1992
+ >>> term = edb.source_excitation.create_edge_port_vertical(0, [0, 0], reference_layer="TopLayer")
2011
1993
  """
2012
1994
  if not port_name:
2013
1995
  port_name = generate_unique_name("Terminal_")
@@ -2079,7 +2061,7 @@ class SourceExcitation:
2079
2061
  --------
2080
2062
  >>> from pyedb import Edb
2081
2063
  >>> edb = Edb()
2082
- >>> edb.source_excitation.create_edge_port_horizontal(0, [0,0], 1, [0,0.1], "EdgePort")
2064
+ >>> edb.source_excitation.create_edge_port_horizontal(0, [0, 0], 1, [0, 0.1], "EdgePort")
2083
2065
  """
2084
2066
  pos_edge_term = self._create_edge_terminal(prim_id, point_on_edge, port_name)
2085
2067
  neg_edge_term = self._create_edge_terminal(ref_prim_id, point_on_ref_edge, port_name + "_ref", is_ref=True)
@@ -2350,7 +2332,7 @@ class SourceExcitation:
2350
2332
  --------
2351
2333
  >>> from pyedb import Edb
2352
2334
  >>> edb = Edb()
2353
- >>> port_name, port = edb.source_excitation.create_bundle_wave_port([0,1], [[0,0],[0,0.2]])
2335
+ >>> port_name, port = edb.source_excitation.create_bundle_wave_port([0, 1], [[0, 0], [0, 0.2]])
2354
2336
  """
2355
2337
  if not port_name:
2356
2338
  port_name = generate_unique_name("bundle_port")
@@ -2453,7 +2435,7 @@ class SourceExcitation:
2453
2435
  --------
2454
2436
  >>> from pyedb import Edb
2455
2437
  >>> edb = Edb()
2456
- >>> term = edb.source_excitation.get_point_terminal("Term1", "Net1", [0,0], "TopLayer")
2438
+ >>> term = edb.source_excitation.get_point_terminal("Term1", "Net1", [0, 0], "TopLayer")
2457
2439
  """
2458
2440
  from pyedb.grpc.database.terminal.point_terminal import PointTerminal
2459
2441
 
@@ -2571,7 +2553,7 @@ class SourceExcitation:
2571
2553
  >>> edb = Edb()
2572
2554
  >>> poly = edb.modeler.primitives[0]
2573
2555
  >>> ref_poly = edb.modeler.primitives[1]
2574
- >>> edb.source_excitation.create_edge_port_on_polygon(poly, ref_poly, [0,0], [0.1,0])
2556
+ >>> edb.source_excitation.create_edge_port_on_polygon(poly, ref_poly, [0, 0], [0.1, 0])
2575
2557
  """
2576
2558
  if not polygon:
2577
2559
  self._logger.error("No polygon provided for port {} creation".format(port_name))
@@ -2679,7 +2661,7 @@ class SourceExcitation:
2679
2661
  for __pin in pins_name:
2680
2662
  if __pin in pins:
2681
2663
  pin = pins[__pin]
2682
- term_name = f"{pin.component.name}_{pin.net.name}_{pin.component}"
2664
+ term_name = f"{pin.component.name}_{pin.net.name}_{pin.component.name}"
2683
2665
  start_layer, stop_layer = pin.get_layer_range()
2684
2666
  if start_layer:
2685
2667
  positive_terminal = PadstackInstanceTerminal.create(
@@ -3081,8 +3063,9 @@ class SourceExcitation:
3081
3063
  --------
3082
3064
  >>> from pyedb import Edb
3083
3065
  >>> edb = Edb()
3084
- >>> probe = edb.source_excitation.place_voltage_probe("Probe1", "Net1", [0,0], "TopLayer",
3085
- ... "GND", [0.1,0], "TopLayer")
3066
+ >>> probe = edb.source_excitation.place_voltage_probe(
3067
+ ... "Probe1", "Net1", [0, 0], "TopLayer", "GND", [0.1, 0], "TopLayer"
3068
+ ... )
3086
3069
  """
3087
3070
  p_terminal = PointTerminal.create(
3088
3071
  layout=self._pedb.active_layout,