Skip to content

Commit d1ba6c0

Browse files
FEATURE: Fixed up utility doc
1 parent 8410bb6 commit d1ba6c0

14 files changed

+446
-296
lines changed

doc/source/api/utility.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@ Classes
2020
transform.Transform
2121
transform3d.Transform3D
2222
value.Value
23+
24+
25+
Enums
26+
-----
27+
28+
.. autosummary::
29+
:toctree: _autosummary
30+
31+
heat_sink.HeatSinkFinOrientation
32+
hfss_extent_info.HFSSExtentInfoType
33+
hfss_extent_info.OpenRegionType
34+
layer_map.LayerMapUniqueDirection

src/ansys/edb/core/layout/cell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ansys.edb.core.primitive.primitive import Primitive
1313
from ansys.edb.core.session import StubAccessor, StubType
1414
from ansys.edb.core.simulation_setup.simulation_setup import SimulationSetup
15-
from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo
15+
from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo, HFSSExtentInfoType, OpenRegionType
1616
from ansys.edb.core.utility.temperature_settings import TemperatureSettings
1717
from ansys.edb.core.utility.value import Value
1818

@@ -93,11 +93,11 @@ def primitive_helper(msg):
9393
},
9494
"HfssExtentsType": {
9595
"msg": _translate_hfss_extents_enums,
96-
"val": HfssExtentInfo.HFSSExtentInfoType,
96+
"val": HFSSExtentInfoType,
9797
},
9898
"HfssExtentsOpenRegionType": {
9999
"msg": _translate_hfss_extents_enums,
100-
"val": HfssExtentInfo.OpenRegionType,
100+
"val": OpenRegionType,
101101
},
102102
}
103103

src/ansys/edb/core/utility/conversions.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
"""This module performs conversions from arbitrary user input to explicit types."""
2+
from __future__ import annotations
3+
4+
from typing import TYPE_CHECKING
5+
6+
if TYPE_CHECKING:
7+
from ansys.edb.core.typing import ValueLike, PointLike, Point3DLike
8+
29
from ansys.api.edb.v1.edb_messages_pb2 import ValueMessage
310

411
from ansys.edb.core.geometry import point3d_data, point_data
512
from ansys.edb.core.utility import value
613

714

8-
def to_value(val):
9-
"""Take a value implicitly convertible to a ``Value``type and return as a ``Value`` type.
15+
def to_value(val: ValueLike) -> value.Value:
16+
"""Take a value implicitly convertible to a :class:`.Value` type and return as a :class:`.Value` type.
1017
1118
Parameters
1219
----------
13-
val : ansys.edb.core.typing.ValueLike
20+
val : :term:`ValueLike`
1421
1522
Returns
1623
-------
17-
:class:`.Value`
24+
.Value
1825
"""
1926
if isinstance(val, value.Value):
2027
return val
@@ -26,16 +33,16 @@ def to_value(val):
2633
)
2734

2835

29-
def to_point(val):
30-
"""Take a value implicitly convertible to a ``PointData`` type and return as a ``PointData`` type.
36+
def to_point(val: PointLike) -> point_data.PointData:
37+
"""Take a value implicitly convertible to a :class:`.PointData` type and return as a :class:`.PointData` type.
3138
3239
Parameters
3340
----------
34-
val : ansys.edb.core.typing.PointLike
41+
val : :term:`Point2DLike`
3542
3643
Returns
3744
-------
38-
:class:`.PointData`
45+
.PointData
3946
"""
4047
if isinstance(val, point_data.PointData):
4148
return val
@@ -50,17 +57,16 @@ def to_point(val):
5057
)
5158

5259

53-
def to_point3d(val):
54-
"""Convert a value to a ``Point3DData`` object.
60+
def to_point3d(val: Point3DLike) -> point3d_data.Point3DData:
61+
"""Take a value implicitly convertible to a :class:`.Point3DData` type and return as a :class:`.Point3DData` type.
5562
5663
Parameters
5764
----------
58-
val : Point3DData, tuple[:term:`ValueLike`,:term:`ValueLike`,:term:`ValueLike`]
59-
Value to convert.
65+
val : :term:`Point3DLike`
6066
6167
Returns
6268
-------
63-
:class:`.Point3DData`
69+
.Point3DData
6470
"""
6571
if isinstance(val, point3d_data.Point3DData):
6672
return val

src/ansys/edb/core/utility/heat_sink.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
"""Heat sink."""
2+
from __future__ import annotations
3+
4+
from typing import TYPE_CHECKING
5+
6+
if TYPE_CHECKING:
7+
from ansys.edb.core.typing import ValueLike
28

39
from enum import Enum
410

@@ -16,7 +22,7 @@ class HeatSinkFinOrientation(Enum):
1622

1723

1824
class HeatSink:
19-
"""Represents a heat sink.
25+
"""Represents a heat sink, a three-dimensional modeling component that can exchange radiation with other objects in the model.
2026
2127
Attributes
2228
----------
@@ -28,20 +34,33 @@ class HeatSink:
2834
Base elevation of the the heat sink.
2935
fin_height : :term:`ValueLike`
3036
Fin height of the heat sink.
31-
fin_orientation : HeatSinkFinOrientation
37+
fin_orientation : .HeatSinkFinOrientation
3238
Fin orientation of the heat sink if it is not set to the X axis.
33-
3439
"""
3540

3641
def __init__(
3742
self,
38-
fin_thickness=0,
39-
fin_spacing=0,
40-
fin_base_height=0,
41-
fin_height=0,
42-
fin_orientation=HeatSinkFinOrientation.X_ORIENTED,
43+
fin_thickness: ValueLike = 0,
44+
fin_spacing: ValueLike = 0,
45+
fin_base_height: ValueLike = 0,
46+
fin_height: ValueLike = 0,
47+
fin_orientation: HeatSinkFinOrientation = HeatSinkFinOrientation.X_ORIENTED,
4348
):
44-
"""Initialize a heat sink object using given values."""
49+
"""Initialize a heat sink object using given values.
50+
51+
Parameters
52+
----------
53+
fin_thickness : :term:`ValueLike`
54+
Fin thickness of the heat sink.
55+
fin_spacing : :term:`ValueLike`
56+
Fin spacing of the heat sink.
57+
fin_base_height : :term:`ValueLike`
58+
Base elevation of the the heat sink.
59+
fin_height : :term:`ValueLike`
60+
Fin height of the heat sink.
61+
fin_orientation : .HeatSinkFinOrientation
62+
Fin orientation of the heat sink if it is not set to the X axis.
63+
"""
4564
self.fin_thickness = conversions.to_value(fin_thickness)
4665
self.fin_spacing = conversions.to_value(fin_spacing)
4766
self.fin_base_height = conversions.to_value(fin_base_height)

src/ansys/edb/core/utility/hfss_extent_info.py

Lines changed: 87 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
"""HFSS extent information."""
2+
from __future__ import annotations
3+
4+
from typing import TYPE_CHECKING, Tuple
5+
6+
if TYPE_CHECKING:
7+
from ansys.edb.core.typing import ValueLike
8+
from ansys.edb.core.primitive.primitive import Primitive
29

310
from enum import Enum
411

@@ -8,128 +15,131 @@
815
from ansys.edb.core.utility.value import Value
916

1017

18+
class HFSSExtentInfoType(Enum):
19+
"""Provides an enum representing available HFSS extent information types."""
20+
21+
BOUNDING_BOX = edb_defs_pb2.HFSS_EXTENT_BOUNDING_BOX
22+
CONFORMING = edb_defs_pb2.HFSS_EXTENT_CONFIRMING
23+
CONVEX_HUL = edb_defs_pb2.HFSS_EXTENT_CONVEX_HULL
24+
POLYGON = edb_defs_pb2.HFSS_EXTENT_POLYGON
25+
26+
class OpenRegionType(Enum):
27+
"""Provides an enum representing open region types."""
28+
29+
RADIATION = edb_defs_pb2.HFSS_EXTENT_RADIATION
30+
PML = edb_defs_pb2.HFSS_EXTENT_PML
31+
32+
1133
class HfssExtentInfo:
1234
"""Provides HFSS extent information.
1335
1436
Attributes
1537
----------
16-
use_open_region: bool
38+
use_open_region : bool, default: ``True``
1739
Whether an open region is used.
18-
extent_type: HfssExtentInfo.HFSSExtentInfoType
40+
extent_type : HFSSExtentInfoType, default: BOUNDING_BOX
1941
Extent type.
20-
open_region_type: HfssExtentInfo.OpenRegionType
42+
open_region_type : OpenRegionType, default: RADIATION
2143
Open region type.
22-
base_polygon: Primitive
44+
base_polygon : .Primitive, default: None
2345
Polygon to use if the extent is the ``Polygon`` type.
24-
dielectric_extent_type: HfssExtentInfo.HFSSExtentInfoType
46+
dielectric_extent_type : HFSSExtentInfoType, default: BOUNDING_BOX
2547
Dielectric extent type.
26-
dielectric_base_polygon : :class:`.Primitive`
27-
Polygon to use if dielectric extent is is the ``Polygon`` type.
28-
dielectric: (float, bool)
29-
Dielectric extent size. The first parameter is the value, and the second parameter \
30-
indicates if the value is a multiple.
31-
honor_user_dielectric: bool
32-
Whether to honor a user-defined dielectric primitive when calculating a dielectric extent.
33-
airbox_truncate_at_ground: bool
48+
dielectric_base_polygon : .Primitive, default: None
49+
Polygon to use if dielectric extent is the ``Polygon`` type.
50+
dielectric : (float, bool), default: (0, True)
51+
Dielectric extent size. The first parameter is the value.
52+
The second parameter is a Boolean indicating if the value is a multiple.
53+
honor_user_dielectric : bool, default: ``True``
54+
Whether to honor a user-defined dielectric primitive when calculating the dielectric
55+
extent.
56+
airbox_truncate_at_ground : bool, default: ``False``
3457
Whether to truncate the airbox at the ground layers.
35-
airbox_horizontal: (float, bool)
36-
Airbox horizontal extent size. The first parameter is the value, and the second parameter \
37-
indicates if the value is a multiple.
38-
airbox_vertical_positive: (float, bool)
39-
Airbox positive vertical extent size. The first parameter is the value, and the second parameter \
40-
indicates if the value is a multiple.
41-
airbox_vertical_negative: (float, bool)
42-
Airbox negative vertical extent size. The first parameter is the value, and the second parameter \
43-
indicates if the value is a multiple.
44-
sync_airbox_vertical_extent: bool
58+
airbox_horizontal : (float, bool), default: (0.15, True)
59+
Airbox horizontal extent size. The first parameter is the value.
60+
The second parameter is a Boolean indicating if the value is a multiple.
61+
airbox_vertical_positive : (float, bool), default: (0.15, True)
62+
Airbox positive vertical extent size. The first parameter is the value.
63+
The second parameter is a Boolean indicating if the value is a multiple.
64+
airbox_vertical_negative : (float, bool), default: (0.15, True)
65+
Airbox negative vertical extent size. The first parameter is the value.
66+
The second parameter is a Boolean indicating if the value is a multiple.
67+
sync_airbox_vertical_extent : bool, default: ``True``
4568
Whether to synchronize the airbox positive and negative vertical extent.
46-
is_pml_visible: bool
47-
Whether to check to see if the PML boxes are to rendered.
48-
operating_frequency : :class:`.Value`
69+
is_pml_visible : bool, default: ``False``
70+
Whether to check to see if PML boxes are to be rendered.
71+
operating_frequency : :term:`ValueLike`, default: ``5GHz``
4972
PML operating frequency.
50-
radiation_level : :class:`.Value`
73+
radiation_level : .Value, default: 0
5174
PML radiation level for calculating the thickness of the boundary.
52-
user_xy_data_extent_for_vertical_expansion: bool
75+
user_xy_data_extent_for_vertical_expansion : bool, default: ``True``
5376
Whether to retain the old behavior for the vertical expansion of the airbox.
54-
If ``True``, the vertical extent is calculated from the XY data extent.
77+
The default is ``True``, in which case the vertical extent is calculated from
78+
the XY data extent.
5579
"""
5680

57-
class HFSSExtentInfoType(Enum):
58-
"""Provides an enum representing available HFSS extent information types."""
59-
60-
BOUNDING_BOX = edb_defs_pb2.HFSS_EXTENT_BOUNDING_BOX
61-
CONFORMING = edb_defs_pb2.HFSS_EXTENT_CONFIRMING
62-
CONVEX_HUL = edb_defs_pb2.HFSS_EXTENT_CONVEX_HULL
63-
POLYGON = edb_defs_pb2.HFSS_EXTENT_POLYGON
64-
65-
class OpenRegionType(Enum):
66-
"""Provides an enum representing open region types."""
67-
68-
RADIATION = edb_defs_pb2.HFSS_EXTENT_RADIATION
69-
PML = edb_defs_pb2.HFSS_EXTENT_PML
70-
7181
def __init__(
7282
self,
73-
use_open_region=True,
74-
extent_type=HFSSExtentInfoType.BOUNDING_BOX,
75-
open_region_type=OpenRegionType.RADIATION,
76-
base_polygon=None,
77-
dielectric_extent_type=HFSSExtentInfoType.BOUNDING_BOX,
78-
dielectric_base_polygon=None,
79-
dielectric=(0, True),
80-
honor_user_dielectric=True,
81-
airbox_truncate_at_ground=False,
82-
airbox_horizontal=(0.15, True),
83-
airbox_vertical_positive=(0.15, True),
84-
airbox_vertical_negative=(0.15, True),
85-
sync_airbox_vertical_extent=True,
86-
is_pml_visible=False,
87-
operating_frequency="5GHz",
88-
radiation_level=Value(0),
89-
user_xy_data_extent_for_vertical_expansion=True,
83+
use_open_region: bool = True,
84+
extent_type: HFSSExtentInfoType = HFSSExtentInfoType.BOUNDING_BOX,
85+
open_region_type: OpenRegionType = OpenRegionType.RADIATION,
86+
base_polygon: Primitive = None,
87+
dielectric_extent_type: HFSSExtentInfoType = HFSSExtentInfoType.BOUNDING_BOX,
88+
dielectric_base_polygon: Primitive = None,
89+
dielectric: Tuple[float, bool] =(0, True),
90+
honor_user_dielectric: bool = True,
91+
airbox_truncate_at_ground: bool = False,
92+
airbox_horizontal: Tuple[float, bool] = (0.15, True),
93+
airbox_vertical_positive: Tuple[float, bool] = (0.15, True),
94+
airbox_vertical_negative: Tuple[float, bool] = (0.15, True),
95+
sync_airbox_vertical_extent: bool = True,
96+
is_pml_visible: bool = False,
97+
operating_frequency: ValueLike = "5GHz",
98+
radiation_level: Value = Value(0),
99+
user_xy_data_extent_for_vertical_expansion: bool = True,
90100
):
91101
"""Create an HFSS extent information object.
92102
93103
Parameters
94104
----------
95-
use_open_region: bool, default: True
105+
use_open_region : bool, default: ``True``
96106
Whether an open region is used.
97-
extent_type: HfssExtentInfo.HFSSExtentInfoType, default: BOUNDING_BOX
107+
extent_type : HFSSExtentInfoType, default: BOUNDING_BOX
98108
Extent type.
99-
open_region_type: HfssExtentInfo.OpenRegionType, default: RADIATION
109+
open_region_type: OpenRegionType, default: RADIATION
100110
Open region type.
101-
base_polygon: Primitive, default: None
111+
base_polygon : .Primitive, default: None
102112
Polygon to use if the extent is the ``Polygon`` type.
103-
dielectric_extent_type: HfssExtentInfo.HFSSExtentInfoType, default: BOUNDING_BOX
113+
dielectric_extent_type : HFSSExtentInfoType, default: BOUNDING_BOX
104114
Dielectric extent type.
105-
dielectric_base_polygon : :class:`.Primitive`, default: None
115+
dielectric_base_polygon : .Primitive, default: None
106116
Polygon to use if dielectric extent is the ``Polygon`` type.
107-
dielectric: (float, bool), default: (0, True)
117+
dielectric : (float, bool), default: (0, True)
108118
Dielectric extent size. The first parameter is the value.
109119
The second parameter is a Boolean indicating if the value is a multiple.
110-
honor_user_dielectric: bool, default: True
120+
honor_user_dielectric : bool, default: ``True``
111121
Whether to honor a user-defined dielectric primitive when calculating the dielectric
112122
extent.
113-
airbox_truncate_at_ground: bool, default: False
123+
airbox_truncate_at_ground : bool, default: ``False``
114124
Whether to truncate the airbox at the ground layers.
115-
airbox_horizontal: (float, bool), default: (0.15, True)
125+
airbox_horizontal : (float, bool), default: (0.15, True)
116126
Airbox horizontal extent size. The first parameter is the value.
117127
The second parameter is a Boolean indicating if the value is a multiple.
118-
airbox_vertical_positive: (float, bool), default: (0.15, True)
128+
airbox_vertical_positive : (float, bool), default: (0.15, True)
119129
Airbox positive vertical extent size. The first parameter is the value.
120130
The second parameter is a Boolean indicating if the value is a multiple.
121-
airbox_vertical_negative: (float, bool), default: (0.15, True)
131+
airbox_vertical_negative : (float, bool), default: (0.15, True)
122132
Airbox negative vertical extent size. The first parameter is the value.
123133
The second parameter is a Boolean indicating if the value is a multiple.
124-
sync_airbox_vertical_extent: bool, default: True
134+
sync_airbox_vertical_extent : bool, default: ``True``
125135
Whether to synchronize the airbox positive and negative vertical extent.
126-
is_pml_visible: bool, default: False
136+
is_pml_visible : bool, default: ``False``
127137
Whether to check to see if PML boxes are to be rendered.
128-
operating_frequency : :class:`.Value`, default: "5GHz"
138+
operating_frequency : :term:`ValueLike`, default: 5GHz
129139
PML operating frequency.
130-
radiation_level : :class:`.Value`, default: 0
140+
radiation_level : .Value, default: 0
131141
PML radiation level for calculating the thickness of the boundary.
132-
user_xy_data_extent_for_vertical_expansion: bool, default: True
142+
user_xy_data_extent_for_vertical_expansion : bool, default: ``True``
133143
Whether to retain the old behavior for the vertical expansion of the airbox.
134144
The default is ``True``, in which case the vertical extent is calculated from
135145
the XY data extent.

0 commit comments

Comments
 (0)