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=None, verbose=True)¶
S matrix model based on Eigenmode Expansion calculation.
- Parameters:
eme_grid_spec (EMEUniformGrid | EMEExplicitGrid | EMECompositeGrid) – 1D grid in the that specifies the EME cells where mode solving is performed along the propagation direction.
medium (Medium | AnisotropicMedium | PECMedium | PoleResidue | Sellmeier | Lorentz | Debye | Drude | FullyAnisotropicMedium | CustomMedium | CustomPoleResidue | CustomSellmeier | CustomLorentz | CustomDebye | CustomDrude | CustomAnisotropicMedium | PerturbationMedium | PerturbationPoleResidue | None) – Background medium. If
None
, the technology default is used.symmetry (Sequence[int]) – Component symmetries.
monitors (Sequence[FieldMonitor | FieldTimeMonitor | PermittivityMonitor | FluxMonitor | FluxTimeMonitor | ModeMonitor | ModeSolverMonitor | FieldProjectionAngleMonitor | FieldProjectionCartesianMonitor | FieldProjectionKSpaceMonitor | DiffractionMonitor]) – Extra field monitors added to the simulation.
structures (Sequence[Structure]) – Additional structures included in the simulations.
grid_spec (float | GridSpec) – Simulation grid specification. A single float can be used to specify the
min_steps_per_wvl
for an auto grid.subpixel (bool) – Flag controlling subpixel averaging in the simulation grid.
bounds (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"
.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_matrix
call.Methods
cache_size
([size])Get/set the runtime cache size for EME and mode simulations.
Clear the runtime cache for EME and mode simulations, but not the file cache.
data_file_for
(component)data_path_for
(component)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.
simulation_data_for
(component)Return the EME simulation data for a given component.
start
(component, frequencies, **kwargs)Start computing the S matrix response from a component.
update
(*args, **kwargs)Update this model.
Attributes
Serialize this model.
parametric_function
Function used to update a parametric component.
parametric_kwargs
Keyword arguments used to update a parametric component.
random_variables
List of
monte_carlo.RandomVariable
associated to this component's parameters.- property as_bytes: bytes¶
Serialize this model.
- static cache_size(size=None)¶
Get/set the runtime cache size for EME and mode simulations.
- Parameters:
size (int | None) – Set a new cache size. A negative value removes the size limit.
- Returns:
Current cache size.
- Return type:
int
- static clear_cache()¶
Clear the runtime cache for EME and mode simulations, but not the file cache.
- Return type:
None
- classmethod from_bytes(byte_repr)¶
De-serialize this model.
- Parameters:
byte_repr (bytes)
- Return type:
- get_simulation(component, frequencies)¶
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_for(component)¶
Return the EME simulation data for a given component.
- Parameters:
component (Component)
- Return type:
EMESimulationData | None
- start(component, frequencies, **kwargs)¶
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.
**kwargs – Unused.
- Returns:
Result object with attributes
status
ands_matrix
.- Return type:
_EMEModelRunner
Important
When using geometry symmetry, the mode numbering in
inputs
is relative to the solver run with the symmetry applied, not the mode number presented in the final S matrix.