EMEModel¶
- class photonforge.EMEModel(eme_grid_spec, medium=None, symmetry=(0, 0, 0), monitors=(), structures=(), grid_spec=None, subpixel=True, bounds=((None, None, None), (None, None, None)), constraint='passive', simulation_updates=None, verbose=True, _use_interface_matrix=False, _grid_transform_matrix=((1.0, 0.0), (0.0, 1.0), (0.0, 0.0)))[source]¶
S matrix model based on Eigenmode Expansion calculation.
- Parameters:
eme_grid_spec (Annotated[EMEUniformGrid | EMEExplicitGrid | EMECompositeGrid, _]) – 1D grid in the that specifies the EME cells where mode solving is performed along the propagation direction.
medium (Annotated[Medium | AnisotropicMedium | PECMedium | PMCMedium | PoleResidue | Sellmeier | Lorentz | Debye | Drude | FullyAnisotropicMedium | CustomMedium | CustomPoleResidue | CustomSellmeier | CustomLorentz | CustomDebye | CustomDrude | CustomAnisotropicMedium | PerturbationMedium | PerturbationPoleResidue | LossyMetalMedium, _] | None) – Background medium. If
None, the technology default is used.symmetry (Annotated[Sequence[int], _]) – Component symmetries.
monitors (Sequence[Annotated[FieldMonitor | FieldTimeMonitor | AuxFieldTimeMonitor | MediumMonitor | PermittivityMonitor | FluxMonitor | FluxTimeMonitor | ModeMonitor | ModeSolverMonitor | FieldProjectionAngleMonitor | FieldProjectionCartesianMonitor | FieldProjectionKSpaceMonitor | DiffractionMonitor | DirectivityMonitor | MicrowaveModeMonitor | MicrowaveModeSolverMonitor | GaussianOverlapMonitor | AstigmaticGaussianOverlapMonitor | SurfaceFieldMonitor | SurfaceFieldTimeMonitor, _]]) – Extra field monitors added to the simulation.
structures (Sequence[Structure]) – Additional structures included in the simulations.
grid_spec (Annotated[float, exclusiveMinimum=0] | GridSpec | None) – Simulation grid specification. A single float can be used to specify the
min_steps_per_wvlfor an auto grid.subpixel (SubpixelSpec | bool) – Flag controlling subpixel averaging in the simulation grid or an instance of
tidy3d.SubpixelSpec.bounds (Annotated[Sequence[Sequence[float | None]], _]) – Bound overrides for the final simulation.
constraint (Literal['passive', 'unitary'] | None) – Constraint for EME propagation. Possible values are
"passive"and"unitary".simulation_updates (dict[str, object] | None) – Dictionary of updates applied to the simulation generated by this model. See example in
Tidy3DModel.verbose (bool) – Control solver verbosity.
If not set, the default values for the component simulations are defined based on the wavelengths used in the
s_matrixcall.Methods
autograd_smatrix(*, component, ...[, ...])Compute an autograd-compatible S matrix for traced parameters.
estimate_cost(*args, **kwargs)Estimate the cost for S matrix computation.
from_bytes(byte_repr)De-serialize this model.
get_simulation(component, frequencies)Create an EME simulation for a component.
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.
simulation_data(component, frequencies, *[, ...])Return the EME simulation data for a given component.
start(component, frequencies, *[, verbose, ...])Start computing the S matrix response from a component.
transform([translation, rotation, scaling, ...])Apply a transformation to this model.
update(*args, **kwargs)Update this model.
Attributes
parametric_functionFunction used to update the model.
parametric_kwargsKeyword arguments used to update the model.
propertiesObject properties.
random_variablesRandom variables associated to the model's parameters.
time_stepperTime stepper associated with this model.
- classmethod from_bytes(byte_repr)[source]¶
De-serialize this model.
- Parameters:
byte_repr (bytes)
- Return type:
- get_simulation(component, frequencies)[source]¶
Create an EME simulation for a component.
- Parameters:
component (Component) – Instance of Component for calculation.
frequencies (Sequence[float]) – Sequence of frequencies for the simulation.
- Returns:
EME simulation and 2 tuples with the names of the ports on each side of the domain.
- Return type:
tuple[EMESimulation, tuple[tuple[str], tuple[str]]]
- simulation_data(component, frequencies, *, verbose=None, show_progress=True, **kwargs)[source]¶
Return the EME simulation data for a given component.
Uses the same arguments as
EMEModel.start().- Parameters:
component (Component)
frequencies (Sequence[float])
verbose (bool | None)
show_progress (bool)
kwargs (object)
- Return type:
EMESimulationData | None
- 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 will not be computed.
**kwargs (object) – Unused.
- Returns:
Result object with attributes
statusands_matrix.- Return type:
_EMEModelRunner
Important
When using geometry symmetry, the mode numbering in
inputsis relative to the solver run with the symmetry applied, not the mode number presented in the final S matrix.
- transform(translation=(0, 0), rotation=0, scaling=1, x_reflection=False)[source]¶
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.- Parameters:
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:
This object with transformations applied.
- Return type: