Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

micromode

An electromagnetic mode solver using the FDFD method on a rectilinear Yee-grid.

pip install micromode

License Tests Coverage PyPI Status

Why Use It?

  • Grid-first API: pass already-rasterized material tensors and grid edges directly, with no required CAD or geometry model.
  • Readable SciPy implementation: sparse operators are assembled in Python and solved with SciPy/ARPACK, so the numerical path can be inspected by users who do not want to trust a custom native solver.
  • Small integration surface: MicroMode is the solver piece you embed after geometry has already been rasterized by an FDTD, FEM, or custom photonics pipeline.
  • Tensor-aware: supports scalar, diagonal anisotropic, and full tensor material grids, plus transformed angle and bend solves.
  • Practical outputs: coordinate-aware fields, n_eff, k_eff, mode area, polarization fractions, Lorentz overlaps, plotting, dataframe export, and HDF5 save/load.
  • Works for both 2D cross sections and 1D slices.

MicroMode is intentionally not a full simulation platform or geometry package. That is the point: you give it a mode-plane material grid, and it returns guided modes with the diagnostics and result helpers needed by downstream simulation workflows.

Micromode is the default mode solver in the BEAMZ FDTD engine.

Quick Start

import micromode as mm

wavelength_um = 1.55
freq = mm.C_0 / wavelength_um

# Arrays from your own rasterizer.
eps_xx, x_edges, y_edges = mode_plane_arrays(...)

materials = mm.Materials.from_diagonal(
    eps_xx=eps_xx,
    x_edges=x_edges,
    y_edges=y_edges,
)

data = mm.solve_modes(
    material_grid=materials,
    freqs=[freq],
    num_modes=2,
    target_neff=2.5,
)

print(data.n_eff.values)
data.plot_field("Ex", mode_index=0)
data.to_hdf5("modes.h5")

Examples

Tidy3D Waveguide

Tidy3D modal monitor example

The Tidy3D modal monitor example recreates the strip-waveguide setup from Flexcompute's modal sources and monitors notebook. It solves the first three x-propagating modes of a silicon waveguide on a silica substrate and plots |Ey| and |Ez| on the same y-z mode plane. (See Tidy3D, "Defining Mode Sources and Monitors".)

uv run --extra dev python examples/tidy3d_modal_sources_monitors.py

Hybridization Sweep

Hybridization sweep example

The SOI hybridization example sweeps the width of a 220 nm silicon ridge and solves several modes at each step. It shows how nearby modes exchange character as the geometry changes by plotting effective index and TE fraction across the sweep in separate figures, then rendering representative field profiles.

uv run --extra dev python examples/soi_hybridization_sweep.py

Physics

MicroMode solves the source-free frequency-domain Maxwell equations on a rasterized Yee mode plane, $\nabla\times\mathbf{E}=-i\omega\mu\mathbf{H}, ; \nabla\times\mathbf{H}=i\omega\epsilon\mathbf{E},$ with modal fields $\mathbf{E},\mathbf{H}\propto e^{i k_0 n_\mathrm{eff} z}.$

On diagonal material grids this becomes a transverse eigenproblem, while full tensor or transformed grids use a first-order tensorial form. The detailed derivation is in docs/physics-model.md, and the public solver controls are summarized in docs/mode-solver-methods.md.

Solver

MicroMode assembles the finite-difference sparse operators in Python and solves the shift-invert eigenproblems with SciPy/ARPACK. That makes the numerical method easier for academic users to inspect and debug, while still using a trusted sparse eigensolver stack.

This means MicroMode is differentiated by workflow and inspectability rather than by a custom solver engine: it is built for users who already have permittivity on a Yee grid and want a focused, auditable mode-solver component that fits cleanly into a larger photonics pipeline.

Metadata

Release files for micromode 0.1.0a6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micromode 0.1.0a6
File Size Uploaded
micromode-0.1.0a6.tar.gz 60.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for micromode 0.1.0a6
File Interpreter ABI Platform
micromode-0.1.0a6-py3-none-any.whl Python 3 none any Details

Total release size: 113.6 kB

Release files / micromode-0.1.0a6.tar.gz

Download URL micromode-0.1.0a6.tar.gz
Size 60.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8920bcd45813b4a51fb26bf0d62fb04c13138da707ecc3161427d87cee99971c
BLAKE2b-256 checksum
How to use checksums
eade1475d5e22fc882c85e6e30e6d27f587ba0124d706cc25daaa8dee7a9836f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log

Release files / micromode-0.1.0a6-py3-none-any.whl

Download URL micromode-0.1.0a6-py3-none-any.whl
Size 53.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8a6bd5ecd712c353d5f1acf9470ca69077b3c97b45ce6b907fa75c30af6c63d
BLAKE2b-256 checksum
How to use checksums
9b69cc452ff7264f1a5f7360199b2b8919bdf6ca8a53feea9710566532e33fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 20, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page