Skip to content

Commit a31e79f

Browse files
fix: rf license warnings and docs
1 parent 9d1f519 commit a31e79f

File tree

9 files changed

+30
-50
lines changed

9 files changed

+30
-50
lines changed

docs/api/plugins/smatrix.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ S-Matrix Component Modelers Plugin
66
This plugin provides component modelers for computing S-parameters (scattering parameters) for both **photonics** and **RF/microwave** applications. The plugin supports:
77

88
* **Photonics**: Modal component modelers for photonic devices (waveguides, splitters, filters, etc.)
9-
* **RF/Microwave**: Terminal component modelers for microwave circuits and antennas (available in :class:`tidy3d.rf` subpackage)
9+
* **RF/Microwave**: Terminal component modelers for microwave circuits and antennas (available in :class:`tidy3d.rf` subpackage as well)
1010

1111
.. warning::
1212

@@ -28,21 +28,26 @@ For photonics applications, use the **ModalComponentModeler** which computes mod
2828

2929
RF/Microwave Component Modelers
3030
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31+
.. seealso::
32+
33+
For classes related to microwave/RF modeling, please refer to the main `Microwave and RF <../microwave/index.html>`_ page and `tidy3d.rf` sub-package.
34+
3135

32-
For RF and microwave applications, use the **TerminalComponentModeler** (available in ``tidy3d.rf``) which computes terminal-based S-parameters.
36+
For RF and microwave applications, use the **TerminalComponentModeler** (available in ``tidy3d.rf`` as well) which computes terminal-based S-parameters.
3337

3438
.. warning::
3539

3640
RF simulations will require new license requirements in an upcoming release. All RF-specific classes are available in the ``tidy3d.rf`` subpackage.
3741

42+
3843
.. autosummary::
3944
:toctree: ../_autosummary/
4045
:template: module.rst
4146

42-
tidy3d.rf.TerminalComponentModeler
43-
tidy3d.rf.TerminalComponentModelerData
44-
tidy3d.rf.LumpedPort
45-
tidy3d.rf.CoaxialLumpedPort
47+
tidy3d.plugins.smatrix.TerminalComponentModeler
48+
tidy3d.plugins.smatrix.TerminalComponentModelerData
49+
tidy3d.plugins.smatrix.LumpedPort
50+
tidy3d.plugins.smatrix.CoaxialLumpedPort
4651
tidy3d.rf.WavePort
4752
tidy3d.rf.MicrowaveSMatrixData
4853
tidy3d.rf.TerminalPortDataArray
@@ -66,4 +71,4 @@ Further Details
6671
tidy3d.plugins.smatrix.AbstractComponentModeler
6772
tidy3d.plugins.smatrix.AbstractComponentModelerData
6873
tidy3d.SimulationMap
69-
tidy3d.SimulationDataMap
74+
tidy3d.SimulationDataMap

tidy3d/components/microwave/base.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,13 @@
22

33
from __future__ import annotations
44

5-
import pydantic.v1 as pd
6-
75
from tidy3d.components.base import Tidy3dBaseModel
86
from tidy3d.config import config
9-
from tidy3d.log import log
107

118

129
class MicrowaveBaseModel(Tidy3dBaseModel):
1310
"""Base model that all RF and microwave specific components inherit from."""
1411

15-
@pd.root_validator(pre=False)
16-
def _warn_rf_license(cls, values):
17-
from tidy3d.config import config
18-
19-
# Skip warning when globally suppressed via config
20-
if not config.microwave.suppress_rf_license_warning:
21-
log.warning(
22-
"ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. "
23-
"You have instantiated at least one RF-specific component.",
24-
log_once=True,
25-
)
26-
return values
27-
2812
@classmethod
2913
def _default_without_license_warning(cls) -> MicrowaveBaseModel:
3014
"""Internal helper factory function for classes inheriting from ``MicrowaveBaseModel``."""

tidy3d/components/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4282,7 +4282,7 @@ def _warn_rf_license(self) -> None:
42824282

42834283
# issue warning
42844284
if rf_component_breakdown_msg != "":
4285-
msg = " ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You are using RF-specific components in this simulation."
4285+
msg = "RF simulations and functionality will require new license requirements in an upcoming release. All RF-specific classes are now available within the sub-package 'tidy3d.rf'."
42864286
msg += rf_component_breakdown_msg
42874287
log.warning(msg, log_once=True)
42884288

tidy3d/log.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ def _log(
251251
) -> None:
252252
"""Distribute log messages to all handlers"""
253253

254+
# Check global cache if requested (before composing/capturing to avoid duplicates)
255+
if log_once:
256+
# Use the message body before composition as key
257+
if message in self._static_cache:
258+
return
259+
self._static_cache.add(message)
260+
254261
# Compose message
255262
if len(args) > 0:
256263
try:
@@ -267,13 +274,6 @@ def _log(
267274
custom_loc = []
268275
self._stack[-1]["messages"].append((level_name, composed_message, custom_loc))
269276

270-
# Check global cache if requested
271-
if log_once:
272-
# Use the message body before composition as key
273-
if message in self._static_cache:
274-
return
275-
self._static_cache.add(message)
276-
277277
# Context-local logger emits a single message and consolidates the rest
278278
if self._counts is not None:
279279
if len(self._counts) > 0:

tidy3d/plugins/smatrix/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# Instantiate on plugin import till we unite with toplevel
3434
warnings.filterwarnings(
3535
"once",
36-
message="ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You have instantiated at least one RF-specific component.",
36+
message="RF simulations and functionality will require new license requirements in an upcoming release. All RF-specific classes are now available within the sub-package 'tidy3d.rf'.",
3737
category=FutureWarning,
3838
)
3939

tidy3d/plugins/smatrix/component_modelers/base.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ class AbstractComponentModeler(ABC, Tidy3dBaseModel):
102102
"Otherwise, a default source time will be constructed.",
103103
)
104104

105+
@pd.root_validator(pre=False)
106+
def _warn_refactor_2_10(cls, values):
107+
log.warning(
108+
f"'{cls.__name__}' was refactored (tidy3d 'v2.10.0'). Existing functionality is available differently. Please consult the migration documentation: https://docs.flexcompute.com/projects/tidy3d/en/latest/api/microwave/microwave_migration.html",
109+
log_once=True,
110+
)
111+
return values
112+
105113
@pd.validator("simulation", always=True)
106114
def _sim_has_no_sources(cls, val):
107115
"""Make sure simulation has no sources as they interfere with tool."""

tidy3d/plugins/smatrix/component_modelers/terminal.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,6 @@ class TerminalComponentModeler(AbstractComponentModeler, MicrowaveBaseModel):
210210
description="The low frequency smoothing parameters for the terminal component simulation.",
211211
)
212212

213-
@pd.root_validator(pre=False)
214-
def _warn_refactor_2_10(cls, values):
215-
log.warning(
216-
f"ℹ️ ⚠️ The {cls.__name__} class was refactored in tidy3d version 2.10. Migration documentation will be provided, and existing functionality can be accessed in a different way.",
217-
log_once=True,
218-
)
219-
return values
220-
221213
@property
222214
def _sim_with_sources(self) -> Simulation:
223215
"""Instance of :class:`.Simulation` with all sources and absorbers added for each port, for plotting."""

tidy3d/plugins/smatrix/data/terminal.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from tidy3d.components.microwave.base import MicrowaveBaseModel
1515
from tidy3d.components.microwave.data.monitor_data import AntennaMetricsData
1616
from tidy3d.constants import C_0
17-
from tidy3d.log import log
1817
from tidy3d.plugins.smatrix.component_modelers.terminal import TerminalComponentModeler
1918
from tidy3d.plugins.smatrix.data.base import AbstractComponentModelerData
2019
from tidy3d.plugins.smatrix.data.data_array import (
@@ -227,14 +226,6 @@ def smatrix_deembedded(self, port_shifts: np.ndarray = None) -> MicrowaveSMatrix
227226
"""Interface function returns de-embedded S-parameter matrix."""
228227
return self.change_port_reference_planes(self.smatrix(), port_shifts=port_shifts)
229228

230-
@pd.root_validator(pre=False)
231-
def _warn_rf_license(cls, values):
232-
log.warning(
233-
"ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You have instantiated at least one RF-specific component.",
234-
log_once=True,
235-
)
236-
return values
237-
238229
def _monitor_data_at_port_amplitude(
239230
self,
240231
port_index: NetworkIndex,

tidy3d/rf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
# Instantiate on plugin import till we unite with toplevel
135135
warnings.filterwarnings(
136136
"once",
137-
message="ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You have instantiated at least one RF-specific component.",
137+
message="RF simulations and functionality will require new license requirements in an upcoming release. All RF-specific classes are now available within the sub-package 'tidy3d.rf'.",
138138
category=FutureWarning,
139139
)
140140

0 commit comments

Comments
 (0)