pyedb 0.53.0__py3-none-any.whl → 0.55.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 (119) hide show
  1. pyedb/__init__.py +1 -8
  2. pyedb/configuration/cfg_boundaries.py +69 -151
  3. pyedb/configuration/cfg_components.py +201 -460
  4. pyedb/configuration/cfg_data.py +4 -2
  5. pyedb/configuration/cfg_general.py +13 -36
  6. pyedb/configuration/cfg_modeler.py +2 -1
  7. pyedb/configuration/cfg_nets.py +21 -35
  8. pyedb/configuration/cfg_operations.py +22 -151
  9. pyedb/configuration/cfg_package_definition.py +56 -112
  10. pyedb/configuration/cfg_padstacks.py +292 -688
  11. pyedb/configuration/cfg_pin_groups.py +32 -79
  12. pyedb/configuration/cfg_ports_sources.py +20 -9
  13. pyedb/configuration/cfg_s_parameter_models.py +67 -172
  14. pyedb/configuration/cfg_setup.py +102 -295
  15. pyedb/configuration/configuration.py +66 -6
  16. pyedb/dotnet/database/cell/connectable.py +38 -9
  17. pyedb/dotnet/database/cell/hierarchy/component.py +28 -28
  18. pyedb/dotnet/database/cell/hierarchy/model.py +1 -1
  19. pyedb/dotnet/database/cell/layout.py +64 -3
  20. pyedb/dotnet/database/cell/layout_obj.py +3 -3
  21. pyedb/dotnet/database/cell/primitive/path.py +6 -8
  22. pyedb/dotnet/database/cell/primitive/primitive.py +10 -31
  23. pyedb/dotnet/database/cell/terminal/edge_terminal.py +2 -2
  24. pyedb/dotnet/database/cell/terminal/padstack_instance_terminal.py +1 -1
  25. pyedb/dotnet/database/cell/terminal/pingroup_terminal.py +1 -1
  26. pyedb/dotnet/database/cell/terminal/point_terminal.py +1 -1
  27. pyedb/dotnet/database/cell/terminal/terminal.py +26 -28
  28. pyedb/dotnet/database/cell/voltage_regulator.py +0 -21
  29. pyedb/dotnet/database/components.py +99 -91
  30. pyedb/dotnet/database/definition/component_def.py +4 -4
  31. pyedb/dotnet/database/definition/component_model.py +1 -1
  32. pyedb/dotnet/database/definition/package_def.py +2 -3
  33. pyedb/dotnet/database/dotnet/database.py +27 -218
  34. pyedb/dotnet/database/dotnet/primitive.py +16 -16
  35. pyedb/dotnet/database/edb_data/control_file.py +5 -5
  36. pyedb/dotnet/database/edb_data/hfss_extent_info.py +6 -6
  37. pyedb/dotnet/database/edb_data/layer_data.py +35 -35
  38. pyedb/dotnet/database/edb_data/padstacks_data.py +65 -90
  39. pyedb/dotnet/database/edb_data/primitives_data.py +5 -5
  40. pyedb/dotnet/database/edb_data/sources.py +6 -6
  41. pyedb/dotnet/database/edb_data/variables.py +8 -4
  42. pyedb/dotnet/database/geometry/point_data.py +14 -10
  43. pyedb/dotnet/database/geometry/polygon_data.py +3 -5
  44. pyedb/dotnet/database/hfss.py +50 -52
  45. pyedb/dotnet/database/layout_validation.py +14 -11
  46. pyedb/dotnet/database/materials.py +10 -11
  47. pyedb/dotnet/database/modeler.py +104 -101
  48. pyedb/dotnet/database/nets.py +20 -23
  49. pyedb/dotnet/database/padstack.py +156 -84
  50. pyedb/dotnet/database/sim_setup_data/data/settings.py +24 -0
  51. pyedb/dotnet/database/sim_setup_data/io/siwave.py +26 -1
  52. pyedb/dotnet/database/siwave.py +47 -47
  53. pyedb/dotnet/database/stackup.py +152 -87
  54. pyedb/dotnet/database/utilities/heatsink.py +4 -4
  55. pyedb/dotnet/database/utilities/obj_base.py +3 -3
  56. pyedb/dotnet/database/utilities/simulation_setup.py +2 -2
  57. pyedb/dotnet/database/utilities/value.py +116 -0
  58. pyedb/dotnet/edb.py +248 -170
  59. pyedb/edb_logger.py +12 -27
  60. pyedb/extensions/via_design_backend.py +6 -3
  61. pyedb/generic/design_types.py +68 -21
  62. pyedb/generic/general_methods.py +0 -120
  63. pyedb/generic/process.py +44 -108
  64. pyedb/generic/settings.py +75 -19
  65. pyedb/grpc/__init__.py +0 -0
  66. pyedb/grpc/database/components.py +55 -17
  67. pyedb/grpc/database/control_file.py +5 -5
  68. pyedb/grpc/database/definition/materials.py +24 -31
  69. pyedb/grpc/database/definition/package_def.py +18 -18
  70. pyedb/grpc/database/definition/padstack_def.py +104 -51
  71. pyedb/grpc/database/geometry/arc_data.py +7 -5
  72. pyedb/grpc/database/geometry/point_3d_data.py +8 -7
  73. pyedb/grpc/database/geometry/polygon_data.py +4 -3
  74. pyedb/grpc/database/hierarchy/component.py +43 -38
  75. pyedb/grpc/database/hierarchy/pin_pair_model.py +15 -14
  76. pyedb/grpc/database/hierarchy/pingroup.py +9 -9
  77. pyedb/grpc/database/layers/stackup_layer.py +45 -44
  78. pyedb/grpc/database/layout/layout.py +17 -13
  79. pyedb/grpc/database/layout/voltage_regulator.py +7 -7
  80. pyedb/grpc/database/layout_validation.py +16 -15
  81. pyedb/grpc/database/modeler.py +60 -58
  82. pyedb/grpc/database/net/net.py +15 -14
  83. pyedb/grpc/database/nets.py +112 -31
  84. pyedb/grpc/database/padstacks.py +303 -190
  85. pyedb/grpc/database/ports/ports.py +5 -6
  86. pyedb/grpc/database/primitive/bondwire.py +8 -7
  87. pyedb/grpc/database/primitive/circle.py +4 -4
  88. pyedb/grpc/database/primitive/padstack_instance.py +191 -23
  89. pyedb/grpc/database/primitive/path.py +7 -7
  90. pyedb/grpc/database/primitive/polygon.py +3 -3
  91. pyedb/grpc/database/primitive/primitive.py +13 -17
  92. pyedb/grpc/database/primitive/rectangle.py +13 -13
  93. pyedb/grpc/database/simulation_setup/hfss_general_settings.py +1 -1
  94. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +10 -0
  95. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +17 -1
  96. pyedb/grpc/database/siwave.py +31 -25
  97. pyedb/grpc/database/source_excitations.py +335 -233
  98. pyedb/grpc/database/stackup.py +165 -148
  99. pyedb/grpc/database/terminal/bundle_terminal.py +18 -8
  100. pyedb/grpc/database/terminal/edge_terminal.py +10 -0
  101. pyedb/grpc/database/terminal/padstack_instance_terminal.py +16 -5
  102. pyedb/grpc/database/terminal/pingroup_terminal.py +12 -11
  103. pyedb/grpc/database/terminal/point_terminal.py +4 -3
  104. pyedb/grpc/database/terminal/terminal.py +9 -9
  105. pyedb/grpc/database/utility/value.py +109 -0
  106. pyedb/grpc/database/utility/xml_control_file.py +5 -5
  107. pyedb/grpc/edb.py +130 -63
  108. pyedb/grpc/edb_init.py +3 -10
  109. pyedb/grpc/rpc_session.py +10 -10
  110. pyedb/libraries/common.py +366 -0
  111. pyedb/libraries/rf_libraries/base_functions.py +1358 -0
  112. pyedb/libraries/rf_libraries/planar_antennas.py +628 -0
  113. pyedb/misc/decorators.py +61 -0
  114. pyedb/misc/misc.py +0 -13
  115. pyedb/siwave.py +2 -2
  116. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/METADATA +2 -3
  117. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/RECORD +119 -112
  118. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/WHEEL +0 -0
  119. {pyedb-0.53.0.dist-info → pyedb-0.55.0.dist-info}/licenses/LICENSE +0 -0
@@ -20,7 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- from typing import List, Set, Union
23
+ from typing import Any, Dict, List, Optional, Set, Tuple, Union
24
24
 
25
25
  from ansys.edb.core.database import ProductIdType as GrpcProductIdType
26
26
  from ansys.edb.core.geometry.point_data import PointData as GrpcPointData
@@ -29,7 +29,6 @@ from ansys.edb.core.terminal.edge_terminal import EdgeTerminal as GrpcEdgeTermin
29
29
  from ansys.edb.core.terminal.edge_terminal import PrimitiveEdge as GrpcPrimitiveEdge
30
30
  from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
31
31
  from ansys.edb.core.utility.rlc import Rlc as GrpcRlc
32
- from ansys.edb.core.utility.value import Value as GrpcValue
33
32
 
34
33
  from pyedb.generic.general_methods import generate_unique_name
35
34
  from pyedb.grpc.database.components import Component
@@ -39,12 +38,15 @@ from pyedb.grpc.database.ports.ports import BundleWavePort, WavePort
39
38
  from pyedb.grpc.database.primitive.padstack_instance import PadstackInstance
40
39
  from pyedb.grpc.database.primitive.primitive import Primitive
41
40
  from pyedb.grpc.database.terminal.bundle_terminal import BundleTerminal
41
+ from pyedb.grpc.database.terminal.edge_terminal import EdgeTerminal
42
42
  from pyedb.grpc.database.terminal.padstack_instance_terminal import (
43
43
  PadstackInstanceTerminal,
44
44
  )
45
45
  from pyedb.grpc.database.terminal.pingroup_terminal import PinGroupTerminal
46
46
  from pyedb.grpc.database.terminal.point_terminal import PointTerminal
47
+ from pyedb.grpc.database.terminal.terminal import Terminal
47
48
  from pyedb.grpc.database.utility.sources import Source, SourceType
49
+ from pyedb.grpc.database.utility.value import Value
48
50
  from pyedb.modeler.geometry_operators import GeometryOperators
49
51
 
50
52
 
@@ -206,25 +208,25 @@ class SourceExcitation:
206
208
  self._pedb = pedb
207
209
 
208
210
  @property
209
- def _logger(self):
211
+ def _logger(self) -> Any:
210
212
  return self._pedb.logger
211
213
 
212
214
  @property
213
- def excitations(self):
215
+ def excitations(self) -> Dict[str, Any]:
214
216
  """Get all excitations."""
215
217
  return self._pedb.excitations
216
218
 
217
219
  @property
218
- def sources(self):
220
+ def sources(self) -> Dict[str, Any]:
219
221
  """Get all sources."""
220
222
  return self._pedb.sources
221
223
 
222
224
  @property
223
- def probes(self):
225
+ def probes(self) -> Dict[str, Any]:
224
226
  """Get all probes."""
225
227
  return self._pedb.probes
226
228
 
227
- def create_source_on_component(self, sources=None):
229
+ def create_source_on_component(self, sources: Optional[Union[Source, List[Source]]] = None) -> bool:
228
230
  """Create voltage, current source, or resistor on component.
229
231
 
230
232
  Parameters
@@ -278,12 +280,12 @@ class SourceExcitation:
278
280
  term_name = source.name
279
281
  positive_pin_group_term.SetName(term_name)
280
282
  negative_pin_group_term.SetName("{}_ref".format(term_name))
281
- positive_pin_group_term.source_amplitude = GrpcValue(source.amplitude)
282
- negative_pin_group_term.source_amplitude = GrpcValue(source.amplitude)
283
- positive_pin_group_term.source_phase = GrpcValue(source.phase)
284
- negative_pin_group_term.source_phase = GrpcValue(source.phase)
285
- positive_pin_group_term.impedance = GrpcValue(source.impedance)
286
- negative_pin_group_term.impedance = GrpcValue(source.impedance)
283
+ positive_pin_group_term.source_amplitude = Value(source.amplitude)
284
+ negative_pin_group_term.source_amplitude = Value(source.amplitude)
285
+ positive_pin_group_term.source_phase = Value(source.phase)
286
+ negative_pin_group_term.source_phase = Value(source.phase)
287
+ positive_pin_group_term.impedance = Value(source.impedance)
288
+ negative_pin_group_term.impedance = Value(source.impedance)
287
289
  positive_pin_group_term.reference_terminal = negative_pin_group_term
288
290
  elif source.source_type == SourceType.Isource: # pragma: no cover
289
291
  positive_pin_group_term = self._pedb.components._create_pin_group_terminal(
@@ -296,12 +298,12 @@ class SourceExcitation:
296
298
  negative_pin_group_term.boundary_type = GrpcBoundaryType.CURRENT_SOURCE
297
299
  positive_pin_group_term.name = source.name
298
300
  negative_pin_group_term.name = "{}_ref".format(source.name)
299
- positive_pin_group_term.source_amplitude = GrpcValue(source.amplitude)
300
- negative_pin_group_term.source_amplitude = GrpcValue(source.amplitude)
301
- positive_pin_group_term.source_phase = GrpcValue(source.phase)
302
- negative_pin_group_term.source_phase = GrpcValue(source.phase)
303
- positive_pin_group_term.impedance = GrpcValue(source.impedance)
304
- negative_pin_group_term.impedance = GrpcValue(source.impedance)
301
+ positive_pin_group_term.source_amplitude = Value(source.amplitude)
302
+ negative_pin_group_term.source_amplitude = Value(source.amplitude)
303
+ positive_pin_group_term.source_phase = Value(source.phase)
304
+ negative_pin_group_term.source_phase = Value(source.phase)
305
+ positive_pin_group_term.impedance = Value(source.impedance)
306
+ negative_pin_group_term.impedance = Value(source.impedance)
305
307
  positive_pin_group_term.reference_terminal = negative_pin_group_term
306
308
  elif source.source_type == SourceType.Rlc: # pragma: no cover
307
309
  self._pedb.components.create(
@@ -314,7 +316,13 @@ class SourceExcitation:
314
316
  )
315
317
  return True
316
318
 
317
- def create_port(self, terminal, ref_terminal=None, is_circuit_port=False, name=None):
319
+ def create_port(
320
+ self,
321
+ terminal: Terminal,
322
+ ref_terminal: Optional[Terminal] = None,
323
+ is_circuit_port: bool = False,
324
+ name: Optional[str] = None,
325
+ ) -> Any:
318
326
  """Create a port.
319
327
 
320
328
  Parameters
@@ -363,14 +371,14 @@ class SourceExcitation:
363
371
 
364
372
  def create_port_on_pins(
365
373
  self,
366
- refdes,
367
- pins,
368
- reference_pins,
369
- impedance=50.0,
370
- port_name=None,
371
- pec_boundary=False,
372
- pingroup_on_single_pin=False,
373
- ):
374
+ refdes: Union[str, Component],
375
+ pins: Union[int, str, PadstackInstance, List[Union[int, str, PadstackInstance]]],
376
+ reference_pins: Union[int, str, PadstackInstance, List[Union[int, str, PadstackInstance]]] = None,
377
+ impedance: Union[str, float] = "50ohm",
378
+ port_name: Optional[str] = None,
379
+ pec_boundary: bool = False,
380
+ pingroup_on_single_pin: bool = False,
381
+ ) -> PadstackInstanceTerminal:
374
382
  """Create circuit port between pins and reference ones.
375
383
 
376
384
  Parameters
@@ -423,12 +431,10 @@ class SourceExcitation:
423
431
  refdes = Component(self._pedb, refdes)
424
432
  pins = self._get_pins_for_ports(pins, refdes)
425
433
  if not pins:
426
- self._logger.error("No pins found during port creation. Port is not defined.")
427
- return False
434
+ raise RuntimeWarning("No pins found during port creation. Port is not defined.")
428
435
  reference_pins = self._get_pins_for_ports(reference_pins, refdes)
429
436
  if not reference_pins:
430
- self._logger.error("No reference pins found during port creation. Port is not defined.")
431
- return False
437
+ raise RuntimeWarning("No reference pins found during port creation. Port is not defined.")
432
438
  if refdes and any(refdes.rlc_values):
433
439
  return self._pedb.components.deactivate_rlc_component(component=refdes, create_circuit_port=True)
434
440
  if not port_name:
@@ -461,7 +467,7 @@ class SourceExcitation:
461
467
  ref_term = self._create_terminal(reference_pins[0], term_name=port_name + "_ref")
462
468
  ref_term.is_circuit_port = True
463
469
 
464
- term.impedance = GrpcValue(impedance)
470
+ term.impedance = Value(impedance)
465
471
  term.reference_terminal = ref_term
466
472
  if pec_boundary:
467
473
  term.is_circuit_port = False
@@ -499,17 +505,17 @@ class SourceExcitation:
499
505
 
500
506
  def create_port_on_component(
501
507
  self,
502
- component,
503
- net_list,
504
- port_type=SourceType.CoaxPort,
505
- do_pingroup=True,
506
- reference_net="gnd",
507
- port_name=None,
508
- solder_balls_height=None,
509
- solder_balls_size=None,
510
- solder_balls_mid_size=None,
511
- extend_reference_pins_outside_component=False,
512
- ):
508
+ component: Union[str, List[str]],
509
+ net_list: Union[str, List[str]],
510
+ port_type: SourceType,
511
+ do_pingroup: Optional[bool] = True,
512
+ reference_net: Optional[str] = None,
513
+ 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,
517
+ extend_reference_pins_outside_component: Optional[bool] = False,
518
+ ) -> List[str]:
513
519
  """Create ports on a component.
514
520
 
515
521
  Parameters
@@ -525,7 +531,7 @@ class SourceExcitation:
525
531
  do_pingroup : bool
526
532
  True activate pingroup during port creation (only used with combination of CircPort),
527
533
  False will take the closest reference pin and generate one port per signal pin.
528
- refnet : string or list of string.
534
+ reference_net : string or list of string.
529
535
  list of the reference net.
530
536
  port_name : str
531
537
  Port name for overwriting the default port-naming convention,
@@ -556,7 +562,7 @@ class SourceExcitation:
556
562
  >>> from pyedb import Edb
557
563
  >>> edbapp = Edb("myaedbfolder")
558
564
  >>> net_list = ["M_DQ<1>", "M_DQ<2>", "M_DQ<3>", "M_DQ<4>", "M_DQ<5>"]
559
- >>> edbapp.components.create_port_on_component(cmp="U2A5", net_list=net_list,
565
+ >>> edbapp.excitations.create_port_on_component(cmp="U2A5", net_list=net_list,
560
566
  >>> port_type=SourceType.CoaxPort, do_pingroup=False, refnet="GND")
561
567
 
562
568
  """
@@ -613,7 +619,7 @@ class SourceExcitation:
613
619
  pad_params = self._pedb.padstacks.get_pad_parameters(pin=cmp_pins[0], layername=pin_layers[0], pad_type=0)
614
620
  if not pad_params[0] == 7:
615
621
  if not solder_balls_size: # pragma no cover
616
- sball_diam = min([GrpcValue(val).value for val in pad_params[1]])
622
+ sball_diam = min([Value(val) for val in pad_params[1]])
617
623
  sball_mid_diam = sball_diam
618
624
  else: # pragma no cover
619
625
  sball_diam = solder_balls_size
@@ -721,7 +727,7 @@ class SourceExcitation:
721
727
  return True
722
728
 
723
729
  @staticmethod
724
- def _normalize_net_list(net_list) -> Set[str]:
730
+ def _normalize_net_list(net_list: Union[str, List[str]]) -> Set[str]:
725
731
  if not isinstance(net_list, list):
726
732
  net_list = [net_list]
727
733
  nets = set()
@@ -734,7 +740,9 @@ class SourceExcitation:
734
740
  nets.add(net)
735
741
  return nets
736
742
 
737
- def _create_terminal(self, pin, term_name=None):
743
+ def _create_terminal(
744
+ self, pin: PadstackInstance, term_name: Optional[str] = None
745
+ ) -> Optional[PadstackInstanceTerminal]:
738
746
  """Create terminal on component pin.
739
747
 
740
748
  Parameters
@@ -759,7 +767,9 @@ class SourceExcitation:
759
767
  layout=self._pedb.layout, name=term_name, padstack_instance=pin, layer=from_layer, net=pin.net, is_ref=False
760
768
  )
761
769
 
762
- def add_port_on_rlc_component(self, component=None, circuit_ports=True, pec_boundary=False):
770
+ def add_port_on_rlc_component(
771
+ self, component: Optional[Union[str, Component]] = None, circuit_ports: bool = True, pec_boundary: bool = False
772
+ ) -> bool:
763
773
  """Deactivate RLC component and replace it with a circuit port.
764
774
  The circuit port supports only two-pin components.
765
775
 
@@ -840,7 +850,7 @@ class SourceExcitation:
840
850
  return True
841
851
  return False
842
852
 
843
- def add_rlc_boundary(self, component=None, circuit_type=True):
853
+ def add_rlc_boundary(self, component: Optional[Union[str, Component]] = None, circuit_type: bool = True) -> bool:
844
854
  """Add RLC gap boundary on component and replace it with a circuit port.
845
855
  The circuit port supports only 2-pin components.
846
856
 
@@ -903,19 +913,25 @@ class SourceExcitation:
903
913
  rlc = GrpcRlc()
904
914
  if rlc_values[0]:
905
915
  rlc.r_enabled = True
906
- rlc.r = GrpcValue(rlc_values[0])
916
+ rlc.r = Value(rlc_values[0])
907
917
  if rlc_values[1]:
908
918
  rlc.l_enabled = True
909
- rlc.l = GrpcValue(rlc_values[1])
919
+ rlc.l = Value(rlc_values[1])
910
920
  if rlc_values[2]:
911
921
  rlc.c_enabled = True
912
- rlc.c = GrpcValue(rlc_values[2])
922
+ rlc.c = Value(rlc_values[2])
913
923
  rlc.is_parallel = component.is_parallel_rlc
914
924
  pos_pin_term.rlc_boundary = rlc
915
925
  self._logger.info("Component {} has been replaced by port".format(component.refdes))
916
926
  return True
917
927
 
918
- def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None, term_type="circuit"):
928
+ def _create_pin_group_terminal(
929
+ self,
930
+ pingroup: Union[str, "PinGroup"],
931
+ isref: bool = False,
932
+ term_name: Optional[str] = None,
933
+ term_type: str = "circuit",
934
+ ) -> Optional["PinGroupTerminal"]:
919
935
  """Creates an EDB pin group terminal from a given EDB pin group.
920
936
 
921
937
  Parameters
@@ -963,7 +979,13 @@ class SourceExcitation:
963
979
  pingroup_term.is_circuit_port = True
964
980
  return pingroup_term
965
981
 
966
- def create_coax_port(self, padstackinstance, use_dot_separator=True, name=None, create_on_top=True):
982
+ def create_coax_port(
983
+ self,
984
+ padstackinstance: Union[PadstackInstance, int],
985
+ use_dot_separator: bool = True,
986
+ name: Optional[str] = None,
987
+ create_on_top: bool = True,
988
+ ) -> Optional[str]:
967
989
  """Create HFSS 3Dlayout coaxial lumped port on a pastack
968
990
  Requires to have solder ball defined before calling this method.
969
991
 
@@ -1030,10 +1052,16 @@ class SourceExcitation:
1030
1052
  )
1031
1053
  return port_name
1032
1054
 
1033
- def _port_exist(self, port_name):
1055
+ def _port_exist(self, port_name: str) -> bool:
1034
1056
  return any(port for port in list(self._pedb.excitations.keys()) if port == port_name)
1035
1057
 
1036
- def _create_edge_terminal(self, prim_id, point_on_edge, terminal_name=None, is_ref=False):
1058
+ def _create_edge_terminal(
1059
+ self,
1060
+ prim_id: Union[int, Primitive],
1061
+ point_on_edge: List[float],
1062
+ terminal_name: Optional[str] = None,
1063
+ is_ref: bool = False,
1064
+ ) -> Optional[GrpcEdgeTerminal]:
1037
1065
  """Create an edge terminal.
1038
1066
 
1039
1067
  Parameters
@@ -1068,7 +1096,13 @@ class SourceExcitation:
1068
1096
  layout=prim.layout, name=terminal_name, edges=pos_edge, net=prim.net, is_ref=is_ref
1069
1097
  )
1070
1098
 
1071
- def create_circuit_port_on_pin(self, pos_pin, neg_pin, impedance=50, port_name=None):
1099
+ def create_circuit_port_on_pin(
1100
+ self,
1101
+ pos_pin: Union[str, PadstackInstance],
1102
+ neg_pin: Union[str, PadstackInstance],
1103
+ impedance: Union[int, float] = 50,
1104
+ port_name: Optional[str] = None,
1105
+ ) -> Optional[str]:
1072
1106
  """Create a circuit port on a pin.
1073
1107
 
1074
1108
  Parameters
@@ -1103,18 +1137,18 @@ class SourceExcitation:
1103
1137
 
1104
1138
  def _create_terminal_on_pins(
1105
1139
  self,
1106
- positive_pin,
1107
- negative_pin,
1108
- name=None,
1109
- use_pin_top_layer=True,
1110
- source_type="circuit_port",
1111
- impedance=50,
1112
- magnitude=0,
1113
- phase=0,
1114
- r=0,
1115
- l=0,
1116
- c=0,
1117
- ):
1140
+ positive_pin: PadstackInstance,
1141
+ negative_pin: PadstackInstance,
1142
+ name: Optional[str] = None,
1143
+ use_pin_top_layer: bool = True,
1144
+ source_type: str = "circuit_port",
1145
+ impedance: Union[int, float, str] = 50,
1146
+ magnitude: Union[int, float, str] = 0,
1147
+ phase: Union[int, float, str] = 0,
1148
+ r: Union[int, float] = 0,
1149
+ l: Union[int, float] = 0,
1150
+ c: Union[int, float] = 0,
1151
+ ) -> Optional[str]:
1118
1152
  """Create a terminal on pins.
1119
1153
 
1120
1154
  Parameters
@@ -1173,7 +1207,7 @@ class SourceExcitation:
1173
1207
  if source_type in ["circuit_port", "lumped_port"]:
1174
1208
  pos_terminal.boundary_type = GrpcBoundaryType.PORT
1175
1209
  neg_terminal.boundary_type = GrpcBoundaryType.PORT
1176
- pos_terminal.impedance = GrpcValue(impedance)
1210
+ pos_terminal.impedance = Value(impedance)
1177
1211
  if source_type == "lumped_port":
1178
1212
  pos_terminal.is_circuit_port = False
1179
1213
  neg_terminal.is_circuit_port = False
@@ -1186,18 +1220,18 @@ class SourceExcitation:
1186
1220
  elif source_type == "current_source":
1187
1221
  pos_terminal.boundary_type = GrpcBoundaryType.CURRENT_SOURCE
1188
1222
  neg_terminal.boundary_type = GrpcBoundaryType.CURRENT_SOURCE
1189
- pos_terminal.source_amplitude = GrpcValue(magnitude)
1190
- pos_terminal.source_phase = GrpcValue(phase)
1191
- pos_terminal.impedance = GrpcValue(impedance)
1223
+ pos_terminal.source_amplitude = Value(magnitude)
1224
+ pos_terminal.source_phase = Value(phase)
1225
+ pos_terminal.impedance = Value(impedance)
1192
1226
  pos_terminal.reference_terminal = neg_terminal
1193
1227
  pos_terminal.name = name
1194
1228
 
1195
1229
  elif source_type == "voltage_source":
1196
1230
  pos_terminal.boundary_type = GrpcBoundaryType.VOLTAGE_SOURCE
1197
1231
  neg_terminal.boundary_type = GrpcBoundaryType.VOLTAGE_SOURCE
1198
- pos_terminal.source_amplitude = GrpcValue(magnitude)
1199
- pos_terminal.impedance = GrpcValue(impedance)
1200
- pos_terminal.source_phase = GrpcValue(phase)
1232
+ pos_terminal.source_amplitude = Value(magnitude)
1233
+ pos_terminal.impedance = Value(impedance)
1234
+ pos_terminal.source_phase = Value(phase)
1201
1235
  pos_terminal.reference_terminal = neg_terminal
1202
1236
  pos_terminal.name = name
1203
1237
 
@@ -1209,9 +1243,9 @@ class SourceExcitation:
1209
1243
  rlc.r_enabled = bool(r)
1210
1244
  rlc.l_enabled = bool(l)
1211
1245
  rlc.c_enabled = bool(c)
1212
- rlc.r = GrpcValue(r)
1213
- rlc.l = GrpcValue(l)
1214
- rlc.c = GrpcValue(c)
1246
+ rlc.r = Value(r)
1247
+ rlc.l = Value(l)
1248
+ rlc.c = Value(c)
1215
1249
  pos_terminal.rlc_boundary_parameters = rlc
1216
1250
  pos_terminal.name = name
1217
1251
 
@@ -1220,7 +1254,14 @@ class SourceExcitation:
1220
1254
  return False
1221
1255
  return pos_terminal.name
1222
1256
 
1223
- def create_voltage_source_on_pin(self, pos_pin, neg_pin, voltage_value=0, phase_value=0, source_name=None):
1257
+ def create_voltage_source_on_pin(
1258
+ self,
1259
+ pos_pin: Union[str, PadstackInstance],
1260
+ neg_pin: Union[str, PadstackInstance],
1261
+ voltage_value: Union[int, float] = 0,
1262
+ phase_value: Union[int, float] = 0,
1263
+ source_name: Optional[str] = None,
1264
+ ) -> Optional[str]:
1224
1265
  """Create a voltage source.
1225
1266
 
1226
1267
  Parameters
@@ -1263,7 +1304,14 @@ class SourceExcitation:
1263
1304
  source_type="voltage_source",
1264
1305
  )
1265
1306
 
1266
- def create_current_source_on_pin(self, pos_pin, neg_pin, current_value=0, phase_value=0, source_name=None):
1307
+ def create_current_source_on_pin(
1308
+ self,
1309
+ pos_pin: Union[str, PadstackInstance],
1310
+ neg_pin: Union[str, PadstackInstance],
1311
+ current_value: Union[int, float] = 0,
1312
+ phase_value: Union[int, float] = 0,
1313
+ source_name: Optional[str] = None,
1314
+ ) -> Optional[str]:
1267
1315
  """Create a voltage source.
1268
1316
 
1269
1317
  Parameters
@@ -1306,7 +1354,13 @@ class SourceExcitation:
1306
1354
  source_type="current_source",
1307
1355
  )
1308
1356
 
1309
- def create_resistor_on_pin(self, pos_pin, neg_pin, rvalue=1, resistor_name=""):
1357
+ def create_resistor_on_pin(
1358
+ self,
1359
+ pos_pin: Union[str, PadstackInstance],
1360
+ neg_pin: Union[str, PadstackInstance],
1361
+ rvalue: Union[int, float] = 1,
1362
+ resistor_name: Optional[str] = "",
1363
+ ) -> Optional[str]:
1310
1364
  """Create a Resistor boundary between two given pins..
1311
1365
 
1312
1366
  Parameters
@@ -1343,13 +1397,13 @@ class SourceExcitation:
1343
1397
 
1344
1398
  def create_circuit_port_on_net(
1345
1399
  self,
1346
- positive_component_name,
1347
- positive_net_name,
1348
- negative_component_name=None,
1349
- negative_net_name=None,
1350
- impedance=50,
1351
- port_name="",
1352
- ):
1400
+ positive_component_name: str,
1401
+ positive_net_name: str,
1402
+ negative_component_name: str,
1403
+ negative_net_name: Optional[str] = None,
1404
+ impedance_value: Union[int, float] = 50,
1405
+ port_name: Optional[str] = None,
1406
+ ) -> Optional[str]:
1353
1407
  """Create a circuit port on a NET.
1354
1408
 
1355
1409
  It groups all pins belonging to the specified net and then applies the port on PinGroups.
@@ -1414,23 +1468,23 @@ class SourceExcitation:
1414
1468
  positive_pins=positive_pins,
1415
1469
  negatives_pins=negative_pins,
1416
1470
  name=port_name,
1417
- impedance=impedance,
1471
+ impedance=impedance_value,
1418
1472
  source_type="circuit_port",
1419
1473
  )
1420
1474
 
1421
1475
  def create_pin_group_terminal(
1422
1476
  self,
1423
- positive_pins,
1424
- negatives_pins,
1425
- name=None,
1426
- impedance=50,
1427
- source_type="circuit_port",
1428
- magnitude=1.0,
1429
- phase=0,
1430
- r=0.0,
1431
- l=0.0,
1432
- c=0.0,
1433
- ):
1477
+ positive_pins: Union[PadstackInstance, List[PadstackInstance]],
1478
+ negatives_pins: Optional[Union[PadstackInstance, List[PadstackInstance]]] = None,
1479
+ name: Optional[str] = None,
1480
+ impedance: Union[int, float, str] = 50,
1481
+ source_type: str = "circuit_port",
1482
+ magnitude: Union[float, str] = 1.0,
1483
+ phase: Union[float, str] = 0,
1484
+ r: float = 0.0,
1485
+ l: float = 0.0,
1486
+ c: float = 0.0,
1487
+ ) -> Optional[str]:
1434
1488
  """Create a pin group terminal.
1435
1489
 
1436
1490
  Parameters
@@ -1490,7 +1544,7 @@ class SourceExcitation:
1490
1544
  )
1491
1545
  if source_type in ["circuit_port", "lumped_port"]:
1492
1546
  pos_pingroup_terminal.boundary_type = GrpcBoundaryType.PORT
1493
- pos_pingroup_terminal.impedance = GrpcValue(impedance)
1547
+ pos_pingroup_terminal.impedance = Value(impedance)
1494
1548
  if len(positive_pins) > 1 and len(negatives_pins) > 1:
1495
1549
  if source_type == "lumped_port":
1496
1550
  source_type = "circuit_port"
@@ -1506,16 +1560,16 @@ class SourceExcitation:
1506
1560
  elif source_type == "current_source":
1507
1561
  pos_pingroup_terminal.boundary_type = GrpcBoundaryType.CURRENT_SOURCE
1508
1562
  neg_pingroup_terminal.boundary_type = GrpcBoundaryType.CURRENT_SOURCE
1509
- pos_pingroup_terminal.source_amplitude = GrpcValue(magnitude)
1510
- pos_pingroup_terminal.source_phase = GrpcValue(phase)
1563
+ pos_pingroup_terminal.source_amplitude = Value(magnitude)
1564
+ pos_pingroup_terminal.source_phase = Value(phase)
1511
1565
  pos_pingroup_terminal.reference_terminal = neg_pingroup_terminal
1512
1566
  pos_pingroup_terminal.name = name
1513
1567
 
1514
1568
  elif source_type == "voltage_source":
1515
1569
  pos_pingroup_terminal.boundary_type = GrpcBoundaryType.VOLTAGE_SOURCE
1516
1570
  neg_pingroup_terminal.boundary_type = GrpcBoundaryType.VOLTAGE_SOURCE
1517
- pos_pingroup_terminal.source_amplitude = GrpcValue(magnitude)
1518
- pos_pingroup_terminal.source_phase = GrpcValue(phase)
1571
+ pos_pingroup_terminal.source_amplitude = Value(magnitude)
1572
+ pos_pingroup_terminal.source_phase = Value(phase)
1519
1573
  pos_pingroup_terminal.reference_terminal = neg_pingroup_terminal
1520
1574
  pos_pingroup_terminal.name = name
1521
1575
 
@@ -1527,9 +1581,9 @@ class SourceExcitation:
1527
1581
  Rlc.r_enabled = bool(r)
1528
1582
  Rlc.l_enabled = bool(l)
1529
1583
  Rlc.c_enabled = bool(c)
1530
- Rlc.r = GrpcValue(r)
1531
- Rlc.l = GrpcValue(l)
1532
- Rlc.c = GrpcValue(c)
1584
+ Rlc.r = Value(r)
1585
+ Rlc.l = Value(l)
1586
+ Rlc.c = Value(c)
1533
1587
  pos_pingroup_terminal.rlc_boundary_parameters = Rlc
1534
1588
 
1535
1589
  elif source_type == "dc_terminal":
@@ -1538,7 +1592,7 @@ class SourceExcitation:
1538
1592
  pass
1539
1593
  return pos_pingroup_terminal.name
1540
1594
 
1541
- def _check_gnd(self, component_name):
1595
+ def _check_gnd(self, component_name: str) -> Optional[str]:
1542
1596
  negative_net_name = None
1543
1597
  if self._pedb.nets.is_net_in_component(component_name, "GND"):
1544
1598
  negative_net_name = "GND"
@@ -1554,14 +1608,14 @@ class SourceExcitation:
1554
1608
 
1555
1609
  def create_voltage_source_on_net(
1556
1610
  self,
1557
- positive_component_name,
1558
- positive_net_name,
1559
- negative_component_name=None,
1560
- negative_net_name=None,
1561
- voltage_value=3.3,
1562
- phase_value=0,
1563
- source_name=None,
1564
- ):
1611
+ positive_component_name: str,
1612
+ positive_net_name: str,
1613
+ negative_component_name: Optional[str] = None,
1614
+ negative_net_name: Optional[str] = None,
1615
+ voltage_value: Union[int, float] = 0,
1616
+ phase_value: Union[int, float] = 0,
1617
+ source_name: Optional[str] = None,
1618
+ ) -> Optional[str]:
1565
1619
  """Create a voltage source.
1566
1620
 
1567
1621
  Parameters
@@ -1617,14 +1671,14 @@ class SourceExcitation:
1617
1671
 
1618
1672
  def create_current_source_on_net(
1619
1673
  self,
1620
- positive_component_name,
1621
- positive_net_name,
1622
- negative_component_name=None,
1623
- negative_net_name=None,
1624
- current_value=3.3,
1625
- phase_value=0,
1626
- source_name=None,
1627
- ):
1674
+ positive_component_name: str,
1675
+ positive_net_name: str,
1676
+ negative_component_name: Optional[str] = None,
1677
+ negative_net_name: Optional[str] = None,
1678
+ current_value: Union[int, float] = 0,
1679
+ phase_value: Union[int, float] = 0,
1680
+ source_name: Optional[str] = None,
1681
+ ) -> Optional[str]:
1628
1682
  """Create a voltage source.
1629
1683
 
1630
1684
  Parameters
@@ -1679,7 +1733,12 @@ class SourceExcitation:
1679
1733
  source_type="current_source",
1680
1734
  )
1681
1735
 
1682
- def create_coax_port_on_component(self, ref_des_list, net_list, delete_existing_terminal=False):
1736
+ def create_coax_port_on_component(
1737
+ self,
1738
+ ref_des_list: Union[str, List[str]],
1739
+ net_list: Union[str, List[str]],
1740
+ delete_existing_terminal: bool = False,
1741
+ ) -> List[str]:
1683
1742
  """Create a coaxial port on a component or component list on a net or net list.
1684
1743
  The name of the new coaxial port is automatically assigned.
1685
1744
 
@@ -1741,7 +1800,7 @@ class SourceExcitation:
1741
1800
  self._logger.error(error)
1742
1801
  return coax
1743
1802
 
1744
- def check_before_terminal_assignement(self, connectable, delete_existing_terminal=False):
1803
+ def check_before_terminal_assignement(self, connectable: Any, delete_existing_terminal: bool = False) -> bool:
1745
1804
  if not connectable:
1746
1805
  return False
1747
1806
  existing_terminals = [term for term in self._pedb.active_layout.terminals if term.id == connectable.id]
@@ -1763,15 +1822,15 @@ class SourceExcitation:
1763
1822
 
1764
1823
  def create_differential_wave_port(
1765
1824
  self,
1766
- positive_primitive_id,
1767
- positive_points_on_edge,
1768
- negative_primitive_id,
1769
- negative_points_on_edge,
1770
- port_name=None,
1771
- horizontal_extent_factor=5,
1772
- vertical_extent_factor=3,
1773
- pec_launch_width="0.01mm",
1774
- ):
1825
+ positive_primitive_id: Union[int, Primitive],
1826
+ positive_points_on_edge: List[float],
1827
+ negative_primitive_id: Union[int, Primitive],
1828
+ negative_points_on_edge: List[float],
1829
+ port_name: Optional[str] = None,
1830
+ horizontal_extent_factor: Union[int, float] = 5,
1831
+ vertical_extent_factor: Union[int, float] = 3,
1832
+ pec_launch_width: str = "0.01mm",
1833
+ ) -> Tuple[str, BundleTerminal]:
1775
1834
  """Create a differential wave port.
1776
1835
 
1777
1836
  Parameters
@@ -1842,14 +1901,14 @@ class SourceExcitation:
1842
1901
 
1843
1902
  def create_wave_port(
1844
1903
  self,
1845
- prim_id,
1846
- point_on_edge,
1847
- port_name=None,
1848
- impedance=50,
1849
- horizontal_extent_factor=5,
1850
- vertical_extent_factor=3,
1851
- pec_launch_width="0.01mm",
1852
- ):
1904
+ prim_id: Union[int, Primitive],
1905
+ point_on_edge: List[float],
1906
+ port_name: Optional[str] = None,
1907
+ impedance: Union[int, float] = 50,
1908
+ horizontal_extent_factor: Union[int, float] = 5,
1909
+ vertical_extent_factor: Union[int, float] = 3,
1910
+ pec_launch_width: str = "0.01mm",
1911
+ ) -> Tuple[str, WavePort]:
1853
1912
  """Create a wave port.
1854
1913
 
1855
1914
  Parameters
@@ -1888,7 +1947,7 @@ class SourceExcitation:
1888
1947
  if isinstance(prim_id, Primitive):
1889
1948
  prim_id = prim_id.edb_uid
1890
1949
  pos_edge_term = self._create_edge_terminal(prim_id, point_on_edge, port_name)
1891
- pos_edge_term.impedance = GrpcValue(impedance)
1950
+ pos_edge_term.impedance = Value(impedance)
1892
1951
  wave_port = WavePort(self._pedb, pos_edge_term)
1893
1952
  wave_port.horizontal_extent_factor = horizontal_extent_factor
1894
1953
  wave_port.vertical_extent_factor = vertical_extent_factor
@@ -1902,16 +1961,16 @@ class SourceExcitation:
1902
1961
 
1903
1962
  def create_edge_port_vertical(
1904
1963
  self,
1905
- prim_id,
1906
- point_on_edge,
1907
- port_name=None,
1908
- impedance=50,
1909
- reference_layer=None,
1910
- hfss_type="Gap",
1911
- horizontal_extent_factor=5,
1912
- vertical_extent_factor=3,
1913
- pec_launch_width="0.01mm",
1914
- ):
1964
+ prim_id: int,
1965
+ point_on_edge: List[float],
1966
+ port_name: Optional[str] = None,
1967
+ impedance: Union[int, float] = 50,
1968
+ reference_layer: Optional[str] = None,
1969
+ hfss_type: str = "Gap",
1970
+ horizontal_extent_factor: Union[int, float] = 5,
1971
+ vertical_extent_factor: Union[int, float] = 3,
1972
+ pec_launch_width: str = "0.01mm",
1973
+ ) -> str:
1915
1974
  """Create a vertical edge port.
1916
1975
 
1917
1976
  Parameters
@@ -1953,7 +2012,7 @@ class SourceExcitation:
1953
2012
  if not port_name:
1954
2013
  port_name = generate_unique_name("Terminal_")
1955
2014
  pos_edge_term = self._create_edge_terminal(prim_id, point_on_edge, port_name)
1956
- pos_edge_term.impedance = GrpcValue(impedance)
2015
+ pos_edge_term.impedance = Value(impedance)
1957
2016
  if reference_layer:
1958
2017
  reference_layer = self._pedb.stackup.signal_layers[reference_layer]
1959
2018
  pos_edge_term.reference_layer = reference_layer
@@ -1980,14 +2039,14 @@ class SourceExcitation:
1980
2039
 
1981
2040
  def create_edge_port_horizontal(
1982
2041
  self,
1983
- prim_id,
1984
- point_on_edge,
1985
- ref_prim_id=None,
1986
- point_on_ref_edge=None,
1987
- port_name=None,
1988
- impedance=50,
1989
- layer_alignment="Upper",
1990
- ):
2042
+ prim_id: Union[int, Primitive],
2043
+ point_on_edge: List[float],
2044
+ ref_prim_id: Optional[Union[int, Primitive]] = None,
2045
+ point_on_ref_edge: Optional[List[float]] = None,
2046
+ port_name: Optional[str] = None,
2047
+ impedance: Union[int, float] = 50,
2048
+ layer_alignment: str = "Upper",
2049
+ ) -> Optional[EdgeTerminal]:
1991
2050
  """Create a horizontal edge port.
1992
2051
 
1993
2052
  Parameters
@@ -2025,7 +2084,7 @@ class SourceExcitation:
2025
2084
  pos_edge_term = self._create_edge_terminal(prim_id, point_on_edge, port_name)
2026
2085
  neg_edge_term = self._create_edge_terminal(ref_prim_id, point_on_ref_edge, port_name + "_ref", is_ref=True)
2027
2086
 
2028
- pos_edge_term.impedance = GrpcValue(impedance)
2087
+ pos_edge_term.impedance = Value(impedance)
2029
2088
  pos_edge_term.reference_terminal = neg_edge_term
2030
2089
  if not layer_alignment == "Upper":
2031
2090
  layer_alignment = "Lower"
@@ -2040,7 +2099,12 @@ class SourceExcitation:
2040
2099
  return False
2041
2100
 
2042
2101
  def create_lumped_port_on_net(
2043
- self, nets=None, reference_layer=None, return_points_only=False, digit_resolution=6, at_bounding_box=True
2102
+ self,
2103
+ nets: Optional[Union[str, List[str]]] = None,
2104
+ reference_layer: Optional[Union[str, StackupLayer]] = None,
2105
+ return_points_only: bool = False,
2106
+ digit_resolution: int = 6,
2107
+ at_bounding_box: bool = True,
2044
2108
  ) -> bool:
2045
2109
  """Create an edge port on nets. This command looks for traces and polygons on the
2046
2110
  nets and tries to assign vertical lumped port.
@@ -2095,11 +2159,11 @@ class SourceExcitation:
2095
2159
  layout_extent_segments = [pt for pt in list(layout_bbox.arc_data) if pt.is_segment]
2096
2160
  first_pt = layout_extent_segments[0]
2097
2161
  layout_extent_points = [
2098
- [first_pt.start.x.value, first_pt.end.x.value],
2099
- [first_pt.Start.y.value, first_pt.end.y.value],
2162
+ [Value(first_pt.start.x), Value(first_pt.end.x)],
2163
+ [Value(first_pt.Start.y), Value(first_pt.end.y)],
2100
2164
  ]
2101
2165
  for segment in layout_extent_segments[1:]:
2102
- end_point = (segment.end.x.value, segment.end.y.value)
2166
+ end_point = (Value(segment.end.x), Value(segment.end.y))
2103
2167
  layout_extent_points[0].append(end_point[0])
2104
2168
  layout_extent_points[1].append(end_point[1])
2105
2169
  for net in nets:
@@ -2110,8 +2174,8 @@ class SourceExcitation:
2110
2174
  port_name = f"{net.name}_{path.id}"
2111
2175
  for pt in trace_path_pts:
2112
2176
  _pt = [
2113
- round(pt.x.value, digit_resolution),
2114
- round(pt.y.value, digit_resolution),
2177
+ round(Value(pt.x), digit_resolution),
2178
+ round(Value(pt.y), digit_resolution),
2115
2179
  ]
2116
2180
  if at_bounding_box:
2117
2181
  if GeometryOperators.point_in_polygon(_pt, layout_extent_points) == 0:
@@ -2134,7 +2198,7 @@ class SourceExcitation:
2134
2198
  for segment in poly_segment:
2135
2199
  if (
2136
2200
  GeometryOperators.point_in_polygon(
2137
- [segment.mid_point.x.value, segment.mid_point.y.value], layout_extent_points
2201
+ [Value(segment.mid_point.x), Value(segment.mid_point.y)], layout_extent_points
2138
2202
  )
2139
2203
  == 0
2140
2204
  ):
@@ -2152,8 +2216,11 @@ class SourceExcitation:
2152
2216
  return port_created
2153
2217
 
2154
2218
  def create_vertical_circuit_port_on_clipped_traces(
2155
- self, nets=None, reference_net=None, user_defined_extent=None
2156
- ) -> list[list[str]]:
2219
+ self,
2220
+ nets: Optional[Union[str, List[str], Net, List[Net]]] = None,
2221
+ reference_net: Optional[Union[str, Net]] = None,
2222
+ user_defined_extent: Optional[Union[List[float], GrpcPolygonData]] = None,
2223
+ ) -> Union[List[List[str]], bool]:
2157
2224
  """Create an edge port on clipped signal traces.
2158
2225
 
2159
2226
  Parameters
@@ -2196,15 +2263,15 @@ class SourceExcitation:
2196
2263
  _x = []
2197
2264
  _y = []
2198
2265
  for pt in _points:
2199
- if pt.x.value < 1e100 and pt.y.value < 1e100:
2200
- _x.append(pt.x.value)
2201
- _y.append(pt.y.value)
2266
+ if Value(pt.x) < 1e100 and Value(pt.y) < 1e100:
2267
+ _x.append(Value(pt.x))
2268
+ _y.append(Value(pt.y))
2202
2269
  user_defined_extent = [_x, _y]
2203
2270
  terminal_info = []
2204
2271
  for net in nets:
2205
2272
  net_polygons = [prim for prim in self._pedb.modeler.primitives if prim.type in ["polygon", "rectangle"]]
2206
2273
  for poly in net_polygons:
2207
- mid_points = [[arc.midpoint.x.value, arc.midpoint.y.value] for arc in poly.arcs]
2274
+ mid_points = [[Value(arc.midpoint.x), Value(arc.midpoint.y)] for arc in poly.arcs]
2208
2275
  for mid_point in mid_points:
2209
2276
  if GeometryOperators.point_in_polygon(mid_point, user_defined_extent) == 0:
2210
2277
  port_name = generate_unique_name(f"{poly.net_name}_{poly.id}")
@@ -2248,13 +2315,13 @@ class SourceExcitation:
2248
2315
 
2249
2316
  def create_bundle_wave_port(
2250
2317
  self,
2251
- primitives_id,
2252
- points_on_edge,
2253
- port_name=None,
2254
- horizontal_extent_factor=5,
2255
- vertical_extent_factor=3,
2256
- pec_launch_width="0.01mm",
2257
- ):
2318
+ primitives_id: List[Union[int, Primitive]],
2319
+ points_on_edge: List[List[float]],
2320
+ port_name: Optional[str] = None,
2321
+ horizontal_extent_factor: Union[int, float] = 5,
2322
+ vertical_extent_factor: Union[int, float] = 3,
2323
+ pec_launch_width: str = "0.01mm",
2324
+ ) -> Tuple[str, BundleWavePort]:
2258
2325
  """Create a bundle wave port.
2259
2326
 
2260
2327
  Parameters
@@ -2308,7 +2375,7 @@ class SourceExcitation:
2308
2375
  _edb_bundle_terminal = BundleTerminal.create(terminals)
2309
2376
  return port_name, BundleWavePort(self._pedb, _edb_bundle_terminal)
2310
2377
 
2311
- def create_hfss_ports_on_padstack(self, pinpos, portname=None):
2378
+ def create_hfss_ports_on_padstack(self, pinpos: PadstackInstance, portname: Optional[str] = None) -> bool:
2312
2379
  """Create an HFSS port on a padstack.
2313
2380
 
2314
2381
  Parameters
@@ -2343,7 +2410,7 @@ class SourceExcitation:
2343
2410
  else:
2344
2411
  return False
2345
2412
 
2346
- def get_ports_number(self):
2413
+ def get_ports_number(self) -> int:
2347
2414
  """Return the total number of excitation ports in a layout.
2348
2415
 
2349
2416
  Parameters
@@ -2364,7 +2431,7 @@ class SourceExcitation:
2364
2431
  terms = [term for term in self._pedb.layout.terminals]
2365
2432
  return len([i for i in terms if not i.is_reference_terminal])
2366
2433
 
2367
- def get_point_terminal(self, name, net_name, location, layer) -> PointTerminal:
2434
+ def get_point_terminal(self, name: str, net_name: str, location: List[float], layer: str) -> PointTerminal:
2368
2435
  """Place terminal between two points.
2369
2436
 
2370
2437
  Parameters
@@ -2394,7 +2461,14 @@ class SourceExcitation:
2394
2461
  layout=self._pedb.active_layout, name=name, net=net_name, layer=layer, point=location
2395
2462
  )
2396
2463
 
2397
- def create_rlc_boundary_on_pins(self, positive_pin=None, negative_pin=None, rvalue=0.0, lvalue=0.0, cvalue=0.0):
2464
+ def create_rlc_boundary_on_pins(
2465
+ self,
2466
+ positive_pin: Optional[PadstackInstance] = None,
2467
+ negative_pin: Optional[PadstackInstance] = None,
2468
+ rvalue: float = 0.0,
2469
+ lvalue: float = 0.0,
2470
+ cvalue: float = 0.0,
2471
+ ) -> Union[Terminal, bool]:
2398
2472
  """Create hfss rlc boundary on pins.
2399
2473
 
2400
2474
  Parameters
@@ -2435,9 +2509,9 @@ class SourceExcitation:
2435
2509
  rlc.r_enabled = True
2436
2510
  rlc.l_enabled = True
2437
2511
  rlc.c_enabled = True
2438
- rlc.r = GrpcValue(rvalue)
2439
- rlc.l = GrpcValue(lvalue)
2440
- rlc.c = GrpcValue(cvalue)
2512
+ rlc.r = Value(rvalue)
2513
+ rlc.l = Value(lvalue)
2514
+ rlc.c = Value(cvalue)
2441
2515
  positive_pin_term.rlc_boundary_parameters = rlc
2442
2516
  term_name = f"{positive_pin.component.name}_{positive_pin.net.name}_{positive_pin.name}"
2443
2517
  positive_pin_term.name = term_name
@@ -2448,15 +2522,15 @@ class SourceExcitation:
2448
2522
 
2449
2523
  def create_edge_port_on_polygon(
2450
2524
  self,
2451
- polygon=None,
2452
- reference_polygon=None,
2453
- terminal_point=None,
2454
- reference_point=None,
2455
- reference_layer=None,
2456
- port_name=None,
2457
- port_impedance=50.0,
2458
- force_circuit_port=False,
2459
- ):
2525
+ polygon: Optional[Primitive] = None,
2526
+ reference_polygon: Optional[Primitive] = None,
2527
+ terminal_point: Optional[List[float]] = None,
2528
+ reference_point: Optional[List[float]] = None,
2529
+ reference_layer: Optional[Union[str, StackupLayer]] = None,
2530
+ port_name: Optional[str] = None,
2531
+ port_impedance: Union[int, float] = 50.0,
2532
+ force_circuit_port: bool = False,
2533
+ ) -> Optional[str]:
2460
2534
  """Create lumped port between two edges from two different polygons. Can also create a vertical port when
2461
2535
  the reference layer name is only provided. When a port is created between two edge from two polygons which don't
2462
2536
  belong to the same layer, a circuit port will be automatically created instead of lumped. To enforce the circuit
@@ -2525,7 +2599,7 @@ class SourceExcitation:
2525
2599
  edge_term.is_circuit_port = False
2526
2600
 
2527
2601
  if port_impedance:
2528
- edge_term.impedance = GrpcValue(port_impedance)
2602
+ edge_term.impedance = Value(port_impedance)
2529
2603
  edge_term.name = port_name
2530
2604
  if reference_polygon and reference_point:
2531
2605
  ref_edge = GrpcPrimitiveEdge.create(reference_polygon, reference_point)
@@ -2545,13 +2619,18 @@ class SourceExcitation:
2545
2619
  ref_edge_term.is_circuit_port = False
2546
2620
 
2547
2621
  if port_impedance:
2548
- ref_edge_term.impedance = GrpcValue(port_impedance)
2622
+ ref_edge_term.impedance = Value(port_impedance)
2549
2623
  edge_term.reference_terminal = ref_edge_term
2550
2624
  return True
2551
2625
 
2552
2626
  def create_port_between_pin_and_layer(
2553
- self, component_name=None, pins_name=None, layer_name=None, reference_net=None, impedance=50.0
2554
- ):
2627
+ self,
2628
+ component_name: Optional[str] = None,
2629
+ pins_name: Optional[Union[str, List[str]]] = None,
2630
+ layer_name: Optional[str] = None,
2631
+ reference_net: Optional[str] = None,
2632
+ impedance: Union[int, float] = 50.0,
2633
+ ) -> bool:
2555
2634
  """Create circuit port between pin and a reference layer.
2556
2635
 
2557
2636
  Parameters
@@ -2607,7 +2686,7 @@ class SourceExcitation:
2607
2686
  layout=pin.layout, net=pin.net, padstack_instance=pin, name=term_name, layer=start_layer
2608
2687
  )
2609
2688
  positive_terminal.boundary_type = GrpcBoundaryType.PORT
2610
- positive_terminal.impedance = GrpcValue(impedance)
2689
+ positive_terminal.impedance = Value(impedance)
2611
2690
  positive_terminal.Is_circuit_port = True
2612
2691
  position = GrpcPointData(self._pedb.components.get_pin_position(pin))
2613
2692
  negative_terminal = PointTerminal.create(
@@ -2618,7 +2697,7 @@ class SourceExcitation:
2618
2697
  point=position,
2619
2698
  )
2620
2699
  negative_terminal.boundary_type = GrpcBoundaryType.PORT
2621
- negative_terminal.impedance = GrpcValue(impedance)
2700
+ negative_terminal.impedance = Value(impedance)
2622
2701
  negative_terminal.is_circuit_port = True
2623
2702
  positive_terminal.reference_terminal = negative_terminal
2624
2703
  self._logger.info("Port {} successfully created".format(term_name))
@@ -2630,7 +2709,11 @@ class SourceExcitation:
2630
2709
  return terms
2631
2710
  return False
2632
2711
 
2633
- def create_current_source(self, terminal, ref_terminal):
2712
+ def create_current_source(
2713
+ self,
2714
+ terminal: Union[PadstackInstanceTerminal, EdgeTerminal],
2715
+ ref_terminal: Union[PadstackInstanceTerminal, EdgeTerminal],
2716
+ ) -> bool:
2634
2717
  """Create a current source.
2635
2718
 
2636
2719
  Parameters
@@ -2668,8 +2751,13 @@ class SourceExcitation:
2668
2751
  return term
2669
2752
 
2670
2753
  def create_current_source_on_pin_group(
2671
- self, pos_pin_group_name, neg_pin_group_name, magnitude=1, phase=0, name=None
2672
- ):
2754
+ self,
2755
+ pos_pin_group_name: str,
2756
+ neg_pin_group_name: str,
2757
+ magnitude: Union[int, float] = 1,
2758
+ phase: Union[int, float] = 0,
2759
+ name: Optional[str] = None,
2760
+ ) -> bool:
2673
2761
  """Create current source between two pin groups.
2674
2762
 
2675
2763
  Parameters
@@ -2707,7 +2795,11 @@ class SourceExcitation:
2707
2795
  pos_terminal.reference_terminal = neg_terminal
2708
2796
  return True
2709
2797
 
2710
- def create_voltage_source(self, terminal, ref_terminal):
2798
+ def create_voltage_source(
2799
+ self,
2800
+ terminal: Union[PadstackInstanceTerminal, EdgeTerminal],
2801
+ ref_terminal: Union[PadstackInstanceTerminal, EdgeTerminal],
2802
+ ) -> bool:
2711
2803
  """Create a voltage source.
2712
2804
 
2713
2805
  Parameters
@@ -2745,8 +2837,14 @@ class SourceExcitation:
2745
2837
  return term
2746
2838
 
2747
2839
  def create_voltage_source_on_pin_group(
2748
- self, pos_pin_group_name, neg_pin_group_name, magnitude=1, phase=0, name=None, impedance=0.001
2749
- ):
2840
+ self,
2841
+ pos_pin_group_name: str,
2842
+ neg_pin_group_name: str,
2843
+ magnitude: Union[int, float] = 1,
2844
+ phase: Union[int, float] = 0,
2845
+ name: Optional[str] = None,
2846
+ impedance: Union[int, float] = 0.001,
2847
+ ) -> bool:
2750
2848
  """Create voltage source between two pin groups.
2751
2849
 
2752
2850
  Parameters
@@ -2789,7 +2887,7 @@ class SourceExcitation:
2789
2887
  pos_terminal.reference_terminal = neg_terminal
2790
2888
  return True
2791
2889
 
2792
- def create_voltage_probe(self, terminal, ref_terminal):
2890
+ def create_voltage_probe(self, terminal: Terminal, ref_terminal: Terminal) -> Terminal:
2793
2891
  """Create a voltage probe.
2794
2892
 
2795
2893
  Parameters
@@ -2820,7 +2918,9 @@ class SourceExcitation:
2820
2918
  term.ref_terminal = ref_terminal
2821
2919
  return term
2822
2920
 
2823
- def create_voltage_probe_on_pin_group(self, probe_name, pos_pin_group_name, neg_pin_group_name, impedance=1000000):
2921
+ def create_voltage_probe_on_pin_group(
2922
+ self, probe_name: str, pos_pin_group_name: str, neg_pin_group_name: str, impedance: Union[int, float] = 1000000
2923
+ ) -> bool:
2824
2924
  """Create voltage probe between two pin groups.
2825
2925
 
2826
2926
  Parameters
@@ -2859,11 +2959,8 @@ class SourceExcitation:
2859
2959
  return not pos_terminal.is_null
2860
2960
 
2861
2961
  def create_dc_terminal(
2862
- self,
2863
- component_name,
2864
- net_name,
2865
- source_name=None,
2866
- ):
2962
+ self, component_name: str, net_name: str, source_name: Optional[str] = None
2963
+ ) -> Optional[str]:
2867
2964
  """Create a dc terminal.
2868
2965
 
2869
2966
  Parameters
@@ -2872,7 +2969,6 @@ class SourceExcitation:
2872
2969
  Name of the positive component.
2873
2970
  net_name : str
2874
2971
  Name of the positive net.
2875
-
2876
2972
  source_name : str, optional
2877
2973
  Name of the source. The default is ``""``.
2878
2974
 
@@ -2897,7 +2993,13 @@ class SourceExcitation:
2897
2993
  positive_pins=node_pin, name=source_name, source_type="dc_terminal", negatives_pins=None
2898
2994
  )
2899
2995
 
2900
- def create_circuit_port_on_pin_group(self, pos_pin_group_name, neg_pin_group_name, impedance=50, name=None):
2996
+ def create_circuit_port_on_pin_group(
2997
+ self,
2998
+ pos_pin_group_name: str,
2999
+ neg_pin_group_name: str,
3000
+ impedance: Union[int, float] = 50,
3001
+ name: Optional[str] = None,
3002
+ ) -> bool:
2901
3003
  """Create a port between two pin groups.
2902
3004
 
2903
3005
  Parameters
@@ -2939,14 +3041,14 @@ class SourceExcitation:
2939
3041
 
2940
3042
  def place_voltage_probe(
2941
3043
  self,
2942
- name,
2943
- positive_net_name,
2944
- positive_location,
2945
- positive_layer,
2946
- negative_net_name,
2947
- negative_location,
2948
- negative_layer,
2949
- ):
3044
+ name: str,
3045
+ positive_net_name: str,
3046
+ positive_location: List[float],
3047
+ positive_layer: str,
3048
+ negative_net_name: str,
3049
+ negative_location: List[float],
3050
+ negative_layer: str,
3051
+ ) -> Terminal:
2950
3052
  """Place a voltage probe between two points.
2951
3053
 
2952
3054
  Parameters