Skip to content

PolarizationSplitterRotatorModel

PolarizationSplitterRotatorModel(
*,
s00: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s01: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s02: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 1,
s03: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s04: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s05: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s11: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s12: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s13: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s14: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 1,
s15: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s22: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s23: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s24: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s25: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s33: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s34: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s35: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s44: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s45: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
s55: complex
| collections.abc.Sequence[complex]
| photonforge.Interpolator = 0,
output_mode: Literal[0, 1] = 0,
ports: Annotated[collections.abc.Sequence[str], maxItems=3, minItems=3]
| None = None,
) -> None

Data model for a polarization splitter rotator.

Two types of PSR models are supported: a 4-port model that assumes a 2-mode input port and 2 single-mode outputs; and a 6-port model that assumes all 3 ports support 2 modes.

The full 6-port S matrix is represented by the usual coefficients:

S6p=[s00s01⋯s05s01s11⋯s15⋮⋮⋱⋮s05s15⋯s55]S_{6p} = \begin{bmatrix} s_{00} & s_{01} & \cdots & s_{05} \\ s_{01} & s_{11} & \cdots & s_{15} \\ \vdots & \vdots & \ddots & \vdots \\ s_{05} & s_{15} & \cdots & s_{55} \\ \end{bmatrix}

The 4-port version drops the coefficients related to the unused mode in the output ports. Using output_mode = 0 (default):

S4p=[s00s01s02s04s01s11s12s14s02s12s22s24s04s14s24s44]S_{4p} = \begin{bmatrix} s_{00} & s_{01} & s_{02} & s_{04} \\ s_{01} & s_{11} & s_{12} & s_{14} \\ s_{02} & s_{12} & s_{22} & s_{24} \\ s_{04} & s_{14} & s_{24} & s_{44} \\ \end{bmatrix}

and using output_mode = 1:

S4p′=[s00s01s03s05s01s11s13s15s03s13s33s35s05s15s35s55]S'_{4p} = \begin{bmatrix} s_{00} & s_{01} & s_{03} & s_{05} \\ s_{01} & s_{11} & s_{13} & s_{15} \\ s_{03} & s_{13} & s_{33} & s_{35} \\ s_{05} & s_{15} & s_{35} & s_{55} \\ \end{bmatrix}

Args

  • s00: Reflection for first mode on input port.
  • s01: Inter-mode reflection for input port.
  • s02: Transmission for first mode on input port to first mode on first output port.
  • s03: Transmission for first mode on input port to second mode on first output port.
  • s04: Transmission for first mode on input port to first mode on second output port.
  • s05: Transmission for first mode on input port to second mode on second output port.
  • s11: Reflection for second mode on input port.
  • s12: Transmission for second mode on input port to first mode on first output port.
  • s13: Transmission for second mode on input port to second mode on first output port.
  • s14: Transmission for second mode on input port to first mode on second output port.
  • s15: Transmission for second mode on input port to second mode on second output port.
  • s22: Reflection for first mode on first output port.
  • s23: Inter-mode reflection for the first output port.
  • s24: Leakage (isolation) between the first mode on the first output port and the first mode on the second output port.
  • s25: Leakage (isolation) between the first mode on the first output port and the second mode on the second output port.
  • s33: Reflection for second mode on first output port.
  • s34: Leakage (isolation) between the second mode on the first output port and the first mode on the second output port.
  • s35: Leakage (isolation) between the second mode on the first output port and the second mode on the second output port.
  • s44: Reflection for first mode on second output port.
  • s45: Inter-mode reflection for the second output port.
  • s55: Reflection for second mode on second output port.
  • output_mode: Full-matrix output mode retained in the 4-port reduction. The reduced output ports use mode 0.
  • ports: List of port names. If not set, the sorted list of port names from the component is used.

Note

Dispersion can be included in the model by setting the coefficients to Interpolator objects or to 1D arrays with the length of the frequencies vector to be used in the computation.

MethodDescription
autograd_smatrixCompute an autograd-compatible S matrix for traced parameters.
black_box_componentCreate a black-box component using this model.
estimate_costEstimate the cost for S matrix computation.
s_matrixCompute the S matrix for a component using this model.
setup_time_stepperObtain a time stepper for a component using this model.
startStart computing the S matrix response from a component.
transformApply a transformation to this model.
updateUpdate this model.

autograd_smatrix(
self,
*,
component,
traced_params,
frequencies,
component_for_params,
param_names,
show_progress=True,
model_kwargs=None,
)

Compute an autograd-compatible S matrix for traced parameters.

Important

This is an abstract method that must be implemented by derived classes that support autograd-based S-matrix computation.

Args

  • component (Component): Nominal component associated with this autograd evaluation.
  • traced_params (ndarray): Traced parameter vector used by autograd.
  • frequencies (Sequence[float]): Frequency values at which to calculate the scattering parameters (in Hz).
  • component_for_params (Callable[[ndarray], Component]): Callback that returns the component for a given traced parameter vector.
  • param_names (Sequence[str]): Flattened traced parameter names aligned with traced_params.
  • show_progress (bool): Progress display hint from Component.s_matrix.
  • model_kwargs (dict[str, Any] | None): Model-specific keyword arguments forwarded from Component.s_matrix.

Returns

AutogradSMatrix: Autograd-compatible S matrix.

black_box_component(
self,
port_spec: str | photonforge.PortSpec | None = None,
output_port_spec: str | photonforge.PortSpec | None = None,
technology: photonforge.Technology | None = None,
name: str | None = None,
) -> photonforge.Component

Create a black-box component using this model.

The layout is the model’s schematic symbol in a box, sized by the port width, with the port profiles drawn as stubs.

Args

  • port_spec: Port specification used in the component. If None, look for "port_spec" in config.default_kwargs.
  • output_port_spec: Port specification used for the output ports in the component. If None, use the same as port_spec.
  • technology: Component technology. If None, the default technology is used.
  • name: Component name. If None a default is used.

Returns

Component with ports and model.

estimate_cost(self, *args, **kwargs)

Estimate the cost for S matrix computation.

All arguments are passed to the model’s start method with the addition of the keyword argument cost_estimation=True.

Returns

float: Cost estimation.

s_matrix(self, component, frequencies, show_progress=True, model_kwargs={})

Compute the S matrix for a component using this model.

Args

  • component (Component): Component to perform the calculation.
  • frequencies (Sequence[float]): Frequency values at which to calculate the scattering parameters (in Hz).
  • show_progress (bool): If True, show computation progress.
  • model_kwargs (dict[str, object]): Keyword arguments passed to Model.start. Accepted arguments depend on the model type.

Returns

SMatrix: Computed S matrix.

Example

Compute only the responses from mode 0 of P0 with Tidy3D to reduce the number and cost of simulations:

>>> model = pf.Tidy3DModel()
>>> s_matrix = model.s_matrix( # doctest: +SKIP
... component,
... frequencies,
... model_kwargs={"inputs": ("P0@0",)},
... )

A port name such as ("P0",) selects all modes of that port. All outputs for the selected inputs are returned; responses from unselected inputs are not computed. Use Model.estimate_cost with the same inputs passed directly to estimate the reduced run.

setup_time_stepper(
self,
component,
time_step,
carrier_frequency=0,
show_progress=True,
time_stepper_kwargs={},
)

Obtain a time stepper for a component using this model.

Args

  • component (Component): Component for the time stepper.
  • time_step (float): The interval between time steps (in seconds).
  • carrier_frequency (float): The carrier frequency used to construct the time stepper. The carrier should be omitted from the input signals, as it is handled automatically by the time stepper.
  • show_progress (bool): If True, show computation progress.
  • time_stepper_kwargs (dict[str, object]): Keyword arguments passed to TimeStepper.setup. Each time stepper type can accept a different set of arguments. Check the documentation for the each time stepper’s setup_state method for more information.

Returns

TimeStepper: Initialized time stepper.

start(
self,
component: photonforge.Component,
frequencies: collections.abc.Sequence[float],
**kwargs: object,
) -> photonforge.SMatrix

Start computing the S matrix response from a component.

Args

  • component: Component from which to compute the S matrix.
  • frequencies: Sequence of frequencies at which to perform the computation.
  • **kwargs: Unused.

Returns

Model result with attributes status and s_matrix.

transform(
self, translation=(0, 0), rotation=0, scaling=1, x_reflection=False
)

Apply a transformation to this model.

The base implementation is a no-op and returns self. Derived classes can override this method to transform model-specific geometry settings.

Args

  • translation (Sequence[float] | complex): Translation vector.
  • rotation (float): Rotation angle in degrees.
  • scaling (float): Magnification factor.
  • x_reflection (bool): Mirror across the horizontal axis.

Returns

Model: This object with transformations applied.

update(self, *args, **kwargs)

Update this model.

All contents of the model are updated with the contents from the updated version. object contents or modifications introduced after the model creation (outside of the original parametric function) are not propagated.

The model’s time stepper does not participate in the update, unless the __init__ method of the derived model class replaces it via set_time_stepper.

Args

  • *args (object): Positional arguments to the parametric model.
  • **kwargs (object): Keyword arguments to the parametric model.

Returns

Model: This model.

Note

The original keyword arguments used to generate the model are stored and updated with the passed kwargs. This updated version is used in the function call and will be stored for future updates. Positional arguments are not stored.

AttributeDescription
parametric_functionstr: Function used to update the model.
parametric_kwargsdict[str, object]: Keyword arguments used to update the model.
propertiesProperties: Object properties.
random_variableslist[RandomVariable]: Random variables associated to the model’s parameters.
time_stepperTimeStepper | None: Time stepper associated with this model.

str: Function used to update the model.

dict[str, object]: Keyword arguments used to update the model.

Properties: Object properties.

list[RandomVariable]: Random variables associated to the model’s parameters.

TimeStepper | None: Time stepper associated with this model.