Skip to content

Commit 97f7db8

Browse files
committed
added docstrings and removed the "transpose" argument from several functions where it wasn't needed.
1 parent 86c035a commit 97f7db8

File tree

10 files changed

+113
-18
lines changed

10 files changed

+113
-18
lines changed

tidy3d/components/base_sim/simulation.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ def plot(
276276
The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
277277
fill_structures : bool = True
278278
Whether to fill structures with color or just draw outlines.
279+
transpose : bool = False
280+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
279281
Returns
280282
-------
281283
matplotlib.axes._subplots.Axes
@@ -335,6 +337,8 @@ def plot_sources(
335337
Opacity of the sources, If ``None`` uses Tidy3d default.
336338
ax : matplotlib.axes._subplots.Axes = None
337339
Matplotlib axes to plot on, if not specified, one is created.
340+
transpose : bool = False
341+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
338342
339343
Returns
340344
-------
@@ -384,6 +388,8 @@ def plot_monitors(
384388
Opacity of the sources, If ``None`` uses Tidy3d default.
385389
ax : matplotlib.axes._subplots.Axes = None
386390
Matplotlib axes to plot on, if not specified, one is created.
391+
transpose : bool = False
392+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
387393
388394
Returns
389395
-------
@@ -502,6 +508,8 @@ def plot_boundaries(
502508
position of plane in z direction, only one of x, y, z must be specified to define plane.
503509
ax : matplotlib.axes._subplots.Axes = None
504510
Matplotlib axes to plot on, if not specified, one is created.
511+
transpose : bool = False
512+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
505513
**kwargs
506514
Optional keyword arguments passed to the matplotlib ``LineCollection``.
507515
For details on accepted values, refer to
@@ -544,6 +552,9 @@ def plot_structures(
544552
The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
545553
fill : bool = True
546554
Whether to fill structures with color or just draw outlines.
555+
transpose : bool = False
556+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
557+
547558
Returns
548559
-------
549560
matplotlib.axes._subplots.Axes
@@ -602,6 +613,8 @@ def plot_structures_eps(
602613
The x range if plotting on xy or xz planes, y range if plotting on yz plane.
603614
vlim : Tuple[float, float] = None
604615
The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
616+
transpose : bool = False
617+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
605618
606619
Returns
607620
-------
@@ -670,6 +683,8 @@ def plot_structures_heat_conductivity(
670683
The x range if plotting on xy or xz planes, y range if plotting on yz plane.
671684
vlim : Tuple[float, float] = None
672685
The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
686+
transpose : bool = False
687+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
673688
674689
Returns
675690
-------

tidy3d/components/eme/simulation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ def plot(
471471
The x range if plotting on xy or xz planes, y range if plotting on yz plane.
472472
vlim : Tuple[float, float] = None
473473
The z range if plotting on xz or yz planes, y plane if plotting on xy plane.
474+
transpose : bool = False
475+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order).
474476
475477
Returns
476478
-------

tidy3d/components/geometry/base.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ def intersections_plane(
252252
Position of plane in y direction, only one of x,y,z can be specified to define plane.
253253
z : float = None
254254
Position of plane in z direction, only one of x,y,z can be specified to define plane.
255+
transpose : bool = False
256+
Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
255257
256258
Returns
257259
-------
@@ -273,6 +275,13 @@ def intersections_2dbox(self, plane: Box, transpose: bool = False) -> list[Shape
273275
"""Returns list of shapely geometries representing the intersections of the geometry with
274276
a 2D box.
275277
278+
Parameters
279+
----------
280+
plane : Box
281+
Plane specification.
282+
transpose : bool = False
283+
Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
284+
276285
Returns
277286
-------
278287
List[shapely.geometry.base.BaseGeometry]
@@ -454,6 +463,8 @@ def _pop_bounds(
454463
----------
455464
axis : int
456465
Integer index into 'xyz' (0,1,2).
466+
transpose : bool = False
467+
Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
457468
458469
Returns
459470
-------
@@ -523,6 +534,8 @@ def plot(
523534
Specify units to use for axis labels, tick labels, and the title.
524535
viz_spec : VisualizationSpec = None
525536
Plotting parameters associated with a medium to use instead of defaults.
537+
transpose : bool = False
538+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
526539
**patch_kwargs
527540
Optional keyword arguments passed to the matplotlib patch plotting of structure.
528541
For details on accepted values, refer to
@@ -605,6 +618,8 @@ def _get_plot_labels(axis: Axis, transpose: bool = False) -> tuple[str, str]:
605618
----------
606619
axis : int
607620
Integer index into 'xyz' (0,1,2).
621+
transpose : bool = False
622+
Optional: Swap horizontal and vertical plot labels. (This overrides the default lexicographic axis order.)
608623
609624
Returns
610625
-------
@@ -635,7 +650,7 @@ def _get_plot_limits(
635650
return (xmin - buffer, xmax + buffer), (ymin - buffer, ymax + buffer)
636651

637652
def add_ax_lims(self, axis: Axis, ax: Ax, buffer: float = PLOT_BUFFER, transpose: bool = False) -> Ax:
638-
"""Sets the x,y limits based on ``self.bounds``.
653+
"""Sets the horizontal and vertical axis limits based on ``self.bounds``.
639654
640655
Parameters
641656
----------
@@ -645,6 +660,8 @@ def add_ax_lims(self, axis: Axis, ax: Ax, buffer: float = PLOT_BUFFER, transpose
645660
Matplotlib axes to add labels and limits on.
646661
buffer : float = 0.3
647662
Amount of space to place around the limits on the + and - sides.
663+
transpose : bool = False
664+
Optional: Swap horizontal and vertical axis limits. (This overrides the default lexicographic axis order.)
648665
649666
Returns
650667
-------
@@ -685,6 +702,8 @@ def add_ax_labels_and_title(
685702
plot_length_units : LengthUnit = None
686703
When set to a supported ``LengthUnit``, plots will be produced with annotated axes
687704
and title with the proper units.
705+
transpose : bool = False
706+
Optional: Swap horizontal and vertical axis labels. (This overrides the default lexicographic axis order.)
688707
689708
Returns
690709
-------
@@ -1772,6 +1791,8 @@ def intersections_plane(
17721791
Position of plane in y direction, only one of x,y,z can be specified to define plane.
17731792
z : float
17741793
Position of plane in z direction, only one of x,y,z can be specified to define plane.
1794+
transpose : bool = False
1795+
Optional: Swap the coordinates in the plane before calculating intersections.
17751796
17761797
Returns
17771798
-------
@@ -1795,8 +1816,8 @@ def _intersections_normal(self, z: float, transpose: bool = False) -> list:
17951816
----------
17961817
z : float
17971818
Position along the axis normal to slab
1798-
transpose : bool
1799-
Optional: Swap the order of the x and y axis in the geometry data.
1819+
transpose : bool = False
1820+
Optional: Swap the coordinates in the plane before calculating intersections.
18001821
18011822
Returns
18021823
-------
@@ -1816,8 +1837,8 @@ def _intersections_side(self, position: float, axis: Axis, transpose: bool = Fal
18161837
Position along axis.
18171838
axis : int
18181839
Integer index into 'xyz' (0,1,2).
1819-
transpose : bool
1820-
Optional: Swap the order of the remaining two axes (the axes not equal to axis).
1840+
transpose : bool = False
1841+
Optional: Swap the coordinates in the perpendicular plane before calculating intersections.
18211842
18221843
Returns
18231844
-------
@@ -2155,8 +2176,8 @@ def intersections_plane(
21552176
Position of plane in y direction, only one of x,y,z can be specified to define plane.
21562177
z : float = None
21572178
Position of plane in z direction, only one of x,y,z can be specified to define plane.
2158-
transpose: bool = False
2159-
Optional: Swap the order of the coordinates in the two remaining (unspecified) axis?
2179+
transpose : bool = False
2180+
Optional: Swap the coordinates in the plane before calculating intersections.
21602181
21612182
Returns
21622183
-------
@@ -2338,6 +2359,8 @@ def _plot_arrow(
23382359
If True, plots an arrow pointing in direction and one in -direction.
23392360
arrow_base : :class:`.Coordinate` = None
23402361
Custom base of the arrow. Uses the geometry's center if not provided.
2362+
transpose : bool = False
2363+
Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
23412364
23422365
Returns
23432366
-------
@@ -3061,6 +3084,8 @@ def intersections_plane(
30613084
Position of plane in y direction, only one of x,y,z can be specified to define plane.
30623085
z : float = None
30633086
Position of plane in z direction, only one of x,y,z can be specified to define plane.
3087+
transpose : bool = False
3088+
Optional: Swap the coordinates in the plane before calculating intersections.
30643089
30653090
Returns
30663091
-------
@@ -3273,6 +3298,8 @@ def intersections_plane(
32733298
Position of plane in y direction, only one of x,y,z can be specified to define plane.
32743299
z : float = None
32753300
Position of plane in z direction, only one of x,y,z can be specified to define plane.
3301+
transpose : bool = False
3302+
Optional: Swap the coordinates in the plane before calculating intersections.
32763303
32773304
Returns
32783305
-------

tidy3d/components/geometry/mesh.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ def intersections_plane(
570570
Position of plane in y direction, only one of x,y,z can be specified to define plane.
571571
z : float = None
572572
Position of plane in z direction, only one of x,y,z can be specified to define plane.
573+
transpose : bool = False
574+
Optional: Swap the coordinates in the plane before calculating intersections.
573575
574576
Returns
575577
-------

tidy3d/components/geometry/polyslab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def _intersections_normal(self, z: float, transpose: bool = False):
637637
z : float
638638
Position along the axis normal to slab.
639639
transpose : bool = False
640-
Optional: Swap the planar (XY) coordinates?
640+
Optional: Swap the coordinates in the plane before calculating intersections.
641641
642642
Returns
643643
-------
@@ -686,7 +686,7 @@ def _intersections_side(self, position, axis, transpose: bool = False) -> list:
686686
axis : int
687687
Integer index into 'xyz' (0,1,2).
688688
transpose : bool = False
689-
Optional: Swap the coordinates in the plane orthogonal to the axis?
689+
Optional: Swap the coordinates in the perpendicular plane before calculating intersections.
690690
691691
Returns
692692
-------

tidy3d/components/geometry/primitives.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def _intersections_normal(self, z: float, transpose: bool = False):
481481
z : float
482482
Position along the axis normal to slab
483483
transpose : bool = False
484-
Optional: Swap the x and y coordinates?
484+
Optional: Swap the coordinates in slab's plane before calculating intersections.
485485
486486
Returns
487487
-------
@@ -514,7 +514,7 @@ def _intersections_side(self, position, axis, transpose: bool = False):
514514
axis : int
515515
Integer index into 'xyz' (0, 1, 2).
516516
transpose : bool = False
517-
Optional: Swap the coordinates in the plane orthogonal to the axis?
517+
Optional: Swap the coordinates in the perpendicular plane before calculating intersections.
518518
519519
Returns
520520
-------
@@ -762,7 +762,7 @@ def _local_to_global_side_cross_section(
762762
coords : List[float, float]
763763
The value in the planar coordinate.
764764
transpose : bool = False
765-
Optional: Swap the coordinates in the plane before converting them?
765+
Optional: Swap the coordinates in the perpendicular plane before calculating intersections.
766766
767767
Returns
768768
-------

tidy3d/components/geometry/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def merging_geometries_on_plane(
5555
Plane specification.
5656
property_list : List = None
5757
Property value for each structure.
58+
transpose : bool = False
59+
Optional: Swap the coordinates in the plane. (This overrides the default lexicographic axis order.)
5860
5961
Returns
6062
-------

0 commit comments

Comments
 (0)