Skip to content

Commit 48c29ea

Browse files
committed
a few greptile comments
1 parent 469d8ae commit 48c29ea

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

tidy3d/components/microwave/path_integral_factory.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def make_voltage_integral(path_spec: VoltagePathSpecTypes) -> VoltageIntegralTyp
3434
3535
Parameters
3636
----------
37-
path_spec : PathSpecTypes
37+
path_spec : VoltagePathSpecTypes
3838
Specification defining the path for voltage integration. Can be either an axis-aligned or
3939
custom path specification.
4040
@@ -48,6 +48,8 @@ def make_voltage_integral(path_spec: VoltagePathSpecTypes) -> VoltageIntegralTyp
4848
v_integral = VoltageIntegralAxisAligned(**path_spec.dict(exclude={"type"}))
4949
elif isinstance(path_spec, CustomVoltageIntegral2DSpec):
5050
v_integral = CustomVoltageIntegral2D(**path_spec.dict(exclude={"type"}))
51+
else:
52+
raise ValidationError(f"Unsupported voltage path specification type: {type(path_spec)}")
5153
return v_integral
5254

5355

@@ -56,7 +58,7 @@ def make_current_integral(path_spec: CurrentPathSpecTypes) -> CurrentIntegralTyp
5658
5759
Parameters
5860
----------
59-
path_spec : PathSpecTypes
61+
path_spec : CurrentPathSpecTypes
6062
Specification defining the path for current integration. Can be either an axis-aligned,
6163
custom, or composite path specification.
6264
@@ -66,13 +68,14 @@ def make_current_integral(path_spec: CurrentPathSpecTypes) -> CurrentIntegralTyp
6668
Current path integral instance corresponding to the provided specification type.
6769
"""
6870
i_integral = None
69-
if path_spec is not None:
70-
if isinstance(path_spec, CurrentIntegralAxisAlignedSpec):
71-
i_integral = CurrentIntegralAxisAligned(**path_spec.dict(exclude={"type"}))
72-
elif isinstance(path_spec, CustomCurrentIntegral2DSpec):
73-
i_integral = CustomCurrentIntegral2D(**path_spec.dict(exclude={"type"}))
74-
elif isinstance(path_spec, CompositeCurrentIntegralSpec):
75-
i_integral = CompositeCurrentIntegral(**path_spec.dict(exclude={"type"}))
71+
if isinstance(path_spec, CurrentIntegralAxisAlignedSpec):
72+
i_integral = CurrentIntegralAxisAligned(**path_spec.dict(exclude={"type"}))
73+
elif isinstance(path_spec, CustomCurrentIntegral2DSpec):
74+
i_integral = CustomCurrentIntegral2D(**path_spec.dict(exclude={"type"}))
75+
elif isinstance(path_spec, CompositeCurrentIntegralSpec):
76+
i_integral = CompositeCurrentIntegral(**path_spec.dict(exclude={"type"}))
77+
else:
78+
raise ValidationError(f"Unsupported current path specification type: {type(path_spec)}")
7679
return i_integral
7780

7881

tidy3d/components/microwave/path_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class AxisAlignedPathIntegralSpec(AbstractAxesRH, Box):
9494
snap_path_to_grid: bool = pd.Field(
9595
False,
9696
title="Snap Path to Grid",
97-
description="It might be desireable to integrate exactly along the Yee grid associated with "
97+
description="It might be desirable to integrate exactly along the Yee grid associated with "
9898
"a field. When this field is ``True``, the integration path will be snapped to the grid.",
9999
)
100100

tidy3d/components/microwave/path_spec_generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ def _check_path_intersects_with_conductors(shapely_list: Shapely, path: Box) ->
222222
bool: True if the path intersects with any conductor geometry, False otherwise.
223223
"""
224224
normal_axis = path.size.index(0.0)
225-
min, max = path.bounds
226-
_, min = Geometry.pop_axis(min, normal_axis)
227-
_, max = Geometry.pop_axis(max, normal_axis)
228-
path_shapely = shapely.box(min[0], min[1], max[0], max[1])
225+
min_b, max_b = path.bounds
226+
_, min_b = Geometry.pop_axis(min_b, normal_axis)
227+
_, max_b = Geometry.pop_axis(max_b, normal_axis)
228+
path_shapely = shapely.box(min_b[0], min_b[1], max_b[0], max_b[1])
229229
for shapely_geo in shapely_list:
230230
if path_shapely.intersects(shapely_geo) and not path_shapely.contains(shapely_geo):
231231
return True

tidy3d/plugins/microwave/path_integrals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ def _to_path_integrals(
258258
"""Returns four ``AxisAlignedPathIntegral`` instances, which represent a contour
259259
integral around the surface defined by ``self.size``."""
260260
path_specs = self._to_path_integral_specs(h_horizontal=h_horizontal, h_vertical=h_vertical)
261-
path_integrals = [
261+
path_integrals = tuple(
262262
AxisAlignedPathIntegral(**path_spec.dict(exclude={"type"})) for path_spec in path_specs
263-
]
264-
return tuple(path_integrals)
263+
)
264+
return path_integrals
265265

266266
@staticmethod
267267
def _set_data_array_attributes(data_array: IntegralResultTypes) -> IntegralResultTypes:

0 commit comments

Comments
 (0)