WaveguideModel

class photonforge.WaveguideModel(n_complex=None, length=None, mesh_refinement=None, verbose=True)[source]

Data model for straight waveguides.

The component is expected to have 2 ports with identical profiles. The S matrix is zero for all reflection or mixed-mode coefficients. Same-mode transmission coefficients are modeled by:

\[S_{jk} = \exp(i 2 \pi f n_c L / c₀)\]

with \(n_c\) the complex effective index for the port profile modes, and \(L\) the waveguide length.

Parameters:
  • n_complex (complex | Sequence[complex] | Sequence[Sequence[complex]] | PortSpec | Literal['cross-section'] | None) – Waveguide complex effective index. For multimode models, a sequence of indices must be provided, one for each mode. If set to None, automatic computation is performed by mode-solving the first component port. If desired, the port specification of the component port can be overridden by setting n_complex to "cross-section" (uses Component.slice_profile()) or to a PortSpec object.

  • length (Annotated[float, units='μm'] | None) – Physical length of the waveguide. If not provided, the length is measured by route_length() or ports distance.

  • mesh_refinement (Annotated[float, exclusiveMinimum=0] | None) – Minimal number of mesh elements per wavelength used for mode solving.

  • verbose (bool) – Flag setting the verbosity of mode solver runs.

Note

Dispersion can be included in the model by setting n_complex to a 2D array with shape (M, N), in which M is the number of modes in the waveguide, and N the length of the frequency sequence used in the S matrix computation.

Methods

black_box_component([port_spec, technology, ...])

Create a black-box component using this model for testing.

estimate_cost(*args, **kwargs)

Estimate the cost for S matrix computation.

from_bytes(byte_repr)

De-serialize this model.

s_matrix(component, frequencies[, ...])

Compute the S matrix for a component using this model.

setup_time_stepper(component, time_step[, ...])

Obtain a time stepper for a component using this model.

start(component, frequencies[, verbose, ...])

Start computing the S matrix response from a component.

update(*args, **kwargs)

Update this model.

Attributes

parametric_function

Function used to update a parametric component.

parametric_kwargs

Keyword arguments used to update a parametric component.

properties

Object properties.

random_variables

Random variables associated to this modles's parameters.

time_stepper

Time stepper associated with this model.

black_box_component(port_spec=None, technology=None, name=None)[source]

Create a black-box component using this model for testing.

Parameters:
  • port_spec (str | PortSpec | None) – Port specification used in the component. If None, look for "port_spec" in config.default_kwargs.

  • technology (Technology | None) – Component technology. If None, the default technology is used.

  • name (str | None) – Component name. If None a default is used.

Returns:

Component with ports and model.

Return type:

Component

classmethod from_bytes(byte_repr)[source]

De-serialize this model.

Parameters:

byte_repr (bytes)

Return type:

WaveguideModel

start(component, frequencies, verbose=None, cost_estimation=False, **kwargs)[source]

Start computing the S matrix response from a component.

Parameters:
  • component (Component) – Component from which to compute the S matrix.

  • frequencies (Sequence[float]) – Sequence of frequencies at which to perform the computation.

  • verbose (bool | None) – If set, overrides the model’s verbose attribute.

  • cost_estimation (bool) – If set, simulations are uploaded, but not executed. S matrix may not be computed.

  • **kwargs (Any) – Unused.

Returns:

Result object with attributes status and s_matrix.

Return type:

SMatrix | _WaveguideModelRunner