fdtdx.unfold_source_mode

fdtdx.unfold_source_mode#

fdtdx.unfold_source_mode(source, config)[source]#

Reconstruct the full-domain (E, H) mode profile a mode source injects.

A ModePlaneSource solves and stores its mode on the reduced cross-section (source._E / source._H, real, shape (3, Nx, Ny, Nz) with a singleton on the propagation axis). This mirrors that profile back to the full transverse cross-section with the correct per-component parity. Only the two transverse axes are unfolded — the propagation axis is never a symmetry plane for a mode source (its mode plane is one cell thick there).

Convenience wrapper so callers don’t reach into the private _E / _H state; for the fields recorded during the run, prefer a detector on the source plane plus unfold_detector_states().

Parameters:
  • source – A placed mode source whose apply has already run (so _E / _H are populated), e.g. a ModePlaneSource. Run fdtdx.apply_params() first.

  • config (SimulationConfig) – Simulation config; must have nonzero symmetry on at least one axis transverse to the source’s propagation axis.

Returns:

Full-domain (E, H) mode profiles, shape (3, Nx, Ny, Nz).

Return type:

tuple[jax.Array, jax.Array]

Raises:

ValueError – If the mode has not been computed yet, the source is not a plane, or there is no transverse symmetry to unfold.