Skip to content

Commit 20a7f36

Browse files
chore: rf namespace and consolidation
1 parent 8b21844 commit 20a7f36

File tree

5 files changed

+248
-4
lines changed

5 files changed

+248
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4141
- Added `interp_spec` in `EMEModeSpec` to enable faster multi-frequency EME simulations. Note that the default is now `ModeInterpSpec.cheb(num_points=3, reduce_data=True)`; previously the computation was repeated at all frequencies.
4242
- Added `smoothed_projection` for topology optimization of completely binarized designs.
4343
- Added more RF-specific mode characteristics to `MicrowaveModeData`, including propagation constants (alpha, beta, gamma), phase/group velocities, wave impedance, and automatic mode classification with configurable polarization thresholds in `MicrowaveModeSpec`.
44+
- Introduce `tidy3d.rf` namespace to consolidate all RF classes.
4445

4546
### Breaking Changes
4647
- Edge singularity correction at PEC and lossy metal edges defaults to `True`.
4748
- `angle_threshold` in `CornerFinderSpec` now defaults to `pi/4`.
48-
**Note: These breaking changes only affect the microwave and smatrix plugins.**
49-
- Renamed path integral classes for improved consistency. Please see our migration guide for details on updating your code.
49+
- `WavePort` has been refactored to use `MicrowaveModeSpec`. The fields `voltage_integral`, and `current_integral` have been removed. Impedance specifications are now defined in `MicrowaveModeSpec.impedance_specs`. Please see our migration guide for details on updating your code.
50+
51+
### Planned Deprecation
52+
**Note: These changes only affect the microwave and smatrix plugins.**
53+
- Renamed path integral classes for improved consistency. Please see our migration guide for details on updating your code. Old class naming is aliased to the new classes for 2.10.
5054
- `VoltageIntegralAxisAligned``AxisAlignedVoltageIntegral`
5155
- `CurrentIntegralAxisAligned``AxisAlignedCurrentIntegral`
5256
- `CustomPathIntegral2D``Custom2DPathIntegral`
5357
- `CustomVoltageIntegral2D``Custom2DVoltageIntegral`
5458
- `CustomCurrentIntegral2D``Custom2DCurrentIntegral`
5559
- Path integral and impedance calculator classes have been refactored and moved from the microwave plugin into Tidy3D components. They are now publicly exported via the top-level package `__init__.py`.
56-
- `WavePort` has been refactored to use `MicrowaveModeSpec`. The fields `voltage_integral`, and `current_integral` have been removed. Impedance specifications are now defined in `MicrowaveModeSpec.impedance_specs`. Please see our migration guide for details on updating your code.
5760

5861
### Changed
5962
- Improved performance of antenna metrics calculation by utilizing cached wave amplitude calculations instead of recomputing wave amplitudes for each port excitation in the `TerminalComponentModelerData`.

tests/rf/test_rf_import.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Test that the rf namespace is correctly populated."""
2+
3+
from __future__ import annotations
4+
5+
import tidy3d.rf
6+
7+
8+
def test_rf_import():
9+
"""Test that tidy3d.rf can be imported."""
10+
assert tidy3d.rf is not None

tidy3d/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,12 @@ def set_logging_level(level: str) -> None:
484484
ClipOperation.update_forward_refs()
485485
GeometryGroup.update_forward_refs()
486486

487+
# Backwards compatibility: Remove 2.11 renamed integral classes
488+
VoltageIntegralAxisAligned = AxisAlignedVoltageIntegral
489+
CurrentIntegralAxisAligned = AxisAlignedCurrentIntegral
490+
CustomVoltageIntegral2D = Custom2DVoltageIntegral
491+
CustomCurrentIntegral2D = Custom2DCurrentIntegral
492+
487493
__all__ = [
488494
"C_0",
489495
"DATA_TYPE_MAP",
@@ -549,12 +555,14 @@ def set_logging_level(level: str) -> None:
549555
"Coords1D",
550556
"CornerFinderSpec",
551557
"CurrentBC",
558+
"CurrentIntegralAxisAligned", # Backwards compatibility alias
552559
"Custom2DCurrentIntegral",
553560
"Custom2DCurrentIntegralSpec",
554561
"Custom2DVoltageIntegral",
555562
"Custom2DVoltageIntegralSpec",
556563
"CustomAnisotropicMedium",
557564
"CustomChargePerturbation",
565+
"CustomCurrentIntegral2D", # Backwards compatibility alias
558566
"CustomCurrentSource",
559567
"CustomDebye",
560568
"CustomDoping",
@@ -570,6 +578,7 @@ def set_logging_level(level: str) -> None:
570578
"CustomSampling",
571579
"CustomSellmeier",
572580
"CustomSourceTime",
581+
"CustomVoltageIntegral2D", # Backwards compatibility alias
573582
"Cylinder",
574583
"DCCurrentSource",
575584
"DCVoltageSource",
@@ -830,6 +839,7 @@ def set_logging_level(level: str) -> None:
830839
"VerticalNaturalConvectionCoeffModel",
831840
"VisualizationSpec",
832841
"VoltageBC",
842+
"VoltageIntegralAxisAligned", # Backwards compatibility alias
833843
"VoltageSourceType",
834844
"VolumeMeshData",
835845
"VolumeMeshMonitor",

tidy3d/plugins/microwave/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@
4040
from .lobe_measurer import LobeMeasurer
4141
from .rf_material_library import rf_material_library
4242

43-
# Backwards compatibility
43+
# Backwards compatibility: Remove 2.11 renamed integral classes
4444
CurrentIntegralTypes = CurrentIntegralType
4545
VoltageIntegralTypes = VoltageIntegralType
46+
VoltageIntegralAxisAligned = AxisAlignedVoltageIntegral
47+
CurrentIntegralAxisAligned = AxisAlignedCurrentIntegral
48+
CustomPathIntegral2D = Custom2DPathIntegral
49+
CustomVoltageIntegral2D = Custom2DVoltageIntegral
50+
CustomCurrentIntegral2D = Custom2DCurrentIntegral
4651

4752
__all__ = [
4853
"AxisAlignedCurrentIntegral",
@@ -52,10 +57,14 @@
5257
"BlackmanWindow",
5358
"ChebWindow",
5459
"CompositeCurrentIntegral",
60+
"CurrentIntegralAxisAligned", # Backwards compatibility alias
5561
"CurrentIntegralTypes",
5662
"Custom2DCurrentIntegral",
5763
"Custom2DPathIntegral",
5864
"Custom2DVoltageIntegral",
65+
"CustomCurrentIntegral2D", # Backwards compatibility alias
66+
"CustomPathIntegral2D", # Backwards compatibility alias
67+
"CustomVoltageIntegral2D", # Backwards compatibility alias
5968
"HammingWindow",
6069
"HannWindow",
6170
"ImpedanceCalculator",
@@ -65,6 +74,7 @@
6574
"RectangularAntennaArrayCalculator",
6675
"RectangularTaper",
6776
"TaylorWindow",
77+
"VoltageIntegralAxisAligned", # Backwards compatibility alias
6878
"VoltageIntegralTypes",
6979
"models",
7080
"path_integrals_from_lumped_element",

tidy3d/rf.py

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
from __future__ import annotations
2+
3+
import warnings
4+
5+
# Boundary
6+
from tidy3d.components.boundary import InternalAbsorber
7+
8+
# Directivity monitor
9+
from tidy3d.components.data.monitor_data import DirectivityData
10+
11+
# Frequency extrapolation
12+
from tidy3d.components.frequency_extrapolation import LowFrequencySmoothingSpec
13+
14+
# Grid spec
15+
from tidy3d.components.grid.grid_spec import CornerFinderSpec, LayerRefinementSpec
16+
17+
# Lumped elements
18+
from tidy3d.components.lumped_element import (
19+
AdmittanceNetwork,
20+
CoaxialLumpedResistor,
21+
LinearLumpedElement,
22+
LumpedResistor,
23+
RectangularLumpedElement,
24+
RLCNetwork,
25+
)
26+
27+
# Material
28+
from tidy3d.components.medium import (
29+
HammerstadSurfaceRoughness,
30+
HuraySurfaceRoughness,
31+
LossyMetalMedium,
32+
SurfaceImpedanceFitterParam,
33+
)
34+
35+
# Microwave data
36+
from tidy3d.components.microwave.data.monitor_data import (
37+
AntennaMetricsData,
38+
MicrowaveModeData,
39+
MicrowaveModeSolverData,
40+
)
41+
42+
# Impedance calculator
43+
from tidy3d.components.microwave.impedance_calculator import (
44+
CurrentIntegralType,
45+
ImpedanceCalculator,
46+
VoltageIntegralType,
47+
)
48+
49+
# Microwave mode spec
50+
from tidy3d.components.microwave.mode_spec import MicrowaveModeSpec
51+
52+
# Microwave monitors
53+
from tidy3d.components.microwave.monitor import MicrowaveModeMonitor, MicrowaveModeSolverMonitor
54+
55+
# Path integrals (actual integrals, not specs)
56+
from tidy3d.components.microwave.path_integrals.integrals.auto import (
57+
path_integrals_from_lumped_element,
58+
)
59+
from tidy3d.components.microwave.path_integrals.integrals.base import (
60+
AxisAlignedPathIntegral,
61+
Custom2DPathIntegral,
62+
)
63+
from tidy3d.components.microwave.path_integrals.integrals.current import (
64+
AxisAlignedCurrentIntegral,
65+
CompositeCurrentIntegral,
66+
Custom2DCurrentIntegral,
67+
)
68+
from tidy3d.components.microwave.path_integrals.integrals.voltage import (
69+
AxisAlignedVoltageIntegral,
70+
Custom2DVoltageIntegral,
71+
)
72+
73+
# Path integral specs
74+
from tidy3d.components.microwave.path_integrals.specs.current import (
75+
AxisAlignedCurrentIntegralSpec,
76+
CompositeCurrentIntegralSpec,
77+
Custom2DCurrentIntegralSpec,
78+
)
79+
from tidy3d.components.microwave.path_integrals.specs.impedance import (
80+
AutoImpedanceSpec,
81+
CustomImpedanceSpec,
82+
)
83+
from tidy3d.components.microwave.path_integrals.specs.voltage import (
84+
AxisAlignedVoltageIntegralSpec,
85+
Custom2DVoltageIntegralSpec,
86+
)
87+
from tidy3d.components.monitor import DirectivityMonitor
88+
89+
# Source frame
90+
from tidy3d.components.source.frame import PECFrame
91+
92+
# Subpixel spec
93+
from tidy3d.components.subpixel_spec import SurfaceImpedance
94+
from tidy3d.plugins.microwave import models
95+
from tidy3d.plugins.microwave.array_factor import (
96+
BlackmanHarrisWindow,
97+
BlackmanWindow,
98+
ChebWindow,
99+
HammingWindow,
100+
HannWindow,
101+
KaiserWindow,
102+
RadialTaper,
103+
RectangularAntennaArrayCalculator,
104+
RectangularTaper,
105+
TaylorWindow,
106+
)
107+
from tidy3d.plugins.microwave.lobe_measurer import LobeMeasurer
108+
from tidy3d.plugins.microwave.rf_material_library import rf_material_library
109+
from tidy3d.plugins.smatrix.component_modelers.base import (
110+
AbstractComponentModeler,
111+
)
112+
from tidy3d.plugins.smatrix.component_modelers.terminal import (
113+
DirectivityMonitorSpec,
114+
ModelerLowFrequencySmoothingSpec,
115+
TerminalComponentModeler,
116+
)
117+
from tidy3d.plugins.smatrix.component_modelers.types import ComponentModelerType
118+
from tidy3d.plugins.smatrix.data.data_array import (
119+
PortDataArray,
120+
TerminalPortDataArray,
121+
)
122+
from tidy3d.plugins.smatrix.data.terminal import (
123+
MicrowaveSMatrixData,
124+
TerminalComponentModelerData,
125+
)
126+
from tidy3d.plugins.smatrix.data.types import ComponentModelerDataType
127+
from tidy3d.plugins.smatrix.ports.coaxial_lumped import CoaxialLumpedPort
128+
from tidy3d.plugins.smatrix.ports.rectangular_lumped import LumpedPort
129+
from tidy3d.plugins.smatrix.ports.wave import WavePort
130+
131+
# Backwards compatibility
132+
CurrentIntegralTypes = CurrentIntegralType
133+
VoltageIntegralTypes = VoltageIntegralType
134+
# Instantiate on plugin import till we unite with toplevel
135+
warnings.filterwarnings(
136+
"once",
137+
message="ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You have instantiated at least one RF-specific component.",
138+
category=FutureWarning,
139+
)
140+
141+
142+
__all__ = [
143+
"AbstractComponentModeler",
144+
"AdmittanceNetwork",
145+
"AntennaMetricsData",
146+
"AutoImpedanceSpec",
147+
"AxisAlignedCurrentIntegral",
148+
"AxisAlignedCurrentIntegralSpec",
149+
"AxisAlignedPathIntegral",
150+
"AxisAlignedVoltageIntegral",
151+
"AxisAlignedVoltageIntegralSpec",
152+
"BlackmanHarrisWindow",
153+
"BlackmanWindow",
154+
"ChebWindow",
155+
"CoaxialLumpedPort",
156+
"CoaxialLumpedResistor",
157+
"ComponentModelerDataType",
158+
"ComponentModelerType",
159+
"CompositeCurrentIntegral",
160+
"CompositeCurrentIntegralSpec",
161+
"CornerFinderSpec",
162+
"CurrentIntegralTypes",
163+
"Custom2DCurrentIntegral",
164+
"Custom2DCurrentIntegralSpec",
165+
"Custom2DPathIntegral",
166+
"Custom2DVoltageIntegral",
167+
"Custom2DVoltageIntegralSpec",
168+
"CustomImpedanceSpec",
169+
"DirectivityData",
170+
"DirectivityMonitor",
171+
"DirectivityMonitorSpec",
172+
"HammerstadSurfaceRoughness",
173+
"HammingWindow",
174+
"HannWindow",
175+
"HuraySurfaceRoughness",
176+
"ImpedanceCalculator",
177+
"InternalAbsorber",
178+
"KaiserWindow",
179+
"LayerRefinementSpec",
180+
"LinearLumpedElement",
181+
"LobeMeasurer",
182+
"LossyMetalMedium",
183+
"LowFrequencySmoothingSpec",
184+
"LumpedPort",
185+
"LumpedResistor",
186+
"MicrowaveModeData",
187+
"MicrowaveModeMonitor",
188+
"MicrowaveModeSolverData",
189+
"MicrowaveModeSolverMonitor",
190+
"MicrowaveModeSpec",
191+
"MicrowaveSMatrixData",
192+
"ModelerLowFrequencySmoothingSpec",
193+
"PECFrame",
194+
"PortDataArray",
195+
"RLCNetwork",
196+
"RadialTaper",
197+
"RectangularAntennaArrayCalculator",
198+
"RectangularLumpedElement",
199+
"RectangularTaper",
200+
"SurfaceImpedance",
201+
"SurfaceImpedanceFitterParam",
202+
"TaylorWindow",
203+
"TerminalComponentModeler",
204+
"TerminalComponentModelerData",
205+
"TerminalPortDataArray",
206+
"VoltageIntegralTypes",
207+
"WavePort",
208+
"models",
209+
"path_integrals_from_lumped_element",
210+
"rf_material_library",
211+
]

0 commit comments

Comments
 (0)