Skip to main content

Rust-backed photonics mode solver with a small Python API.

Project description

micromode

An electromagnetic mode solver using the FDFD method on a rectilinear Yee-grid, written in native Rust.

pip install micromode

License Tests Coverage PyPI Status

Why Use It?

  • Grid-first API: pass arrays directly, with no required geometry model.
  • Fast, portable Rust sparse backend: one production solve path.
  • Practical outputs: fields, n_eff, k_eff, mode area, polarization fractions, Lorentz overlaps, plotting, dataframe export, and HDF5 save/load.
  • Tensor-aware: supports scalar, diagonal anisotropic, and full tensor material grids.
  • Works for both 2D cross sections and 1D slices.

You give it a material grid. It returns guided modes: effective indices, six-component fields, polarization metrics, mode area, overlaps, diagnostics, plots, and HDF5 output. MicroMode is intentionally not a CAD or geometry package. It is the solver piece you use after geometry has already been rasterized onto a mode-plane grid.

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, 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 is designed to make high-performance mode solving available without requiring users to install external solver stacks. The production backend is a portable Rust sparse shift-invert eigensolver, so source installs and wheels do not depend on ARPACK, UMFPACK, SuiteSparse, BLAS/ LAPACK, or a Fortran compiler. That matters for simulation workflows that need to run in CI, notebooks, container images, FDTD plugins, and cross-platform design tools.

The native solver is not a dense fallback. It uses sparse finite-difference operators throughout, applies AMD fill-reducing ordering before sparse LU factorization, stores LU factors in a packed format for repeated triangular solves, and runs an Arnoldi iteration targeted around the requested effective index. The Arnoldi stage uses shift-invert, adaptive Ritz-pair checkpointing, early stopping once requested modes are stable, and selective Ritz vector reconstruction so work is spent on the modes that will actually be returned.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micromode-0.1.0a4.tar.gz (11.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

micromode-0.1.0a4-cp313-cp313-win_amd64.whl (300.5 kB view details)

Uploaded CPython 3.13Windows x86-64

micromode-0.1.0a4-cp313-cp313-manylinux_2_35_x86_64.whl (432.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

micromode-0.1.0a4-cp313-cp313-macosx_11_0_arm64.whl (379.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

micromode-0.1.0a4-cp313-cp313-macosx_10_12_x86_64.whl (396.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

micromode-0.1.0a4-cp312-cp312-win_amd64.whl (300.6 kB view details)

Uploaded CPython 3.12Windows x86-64

micromode-0.1.0a4-cp312-cp312-manylinux_2_35_x86_64.whl (433.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

micromode-0.1.0a4-cp312-cp312-macosx_11_0_arm64.whl (379.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

micromode-0.1.0a4-cp312-cp312-macosx_10_12_x86_64.whl (396.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

micromode-0.1.0a4-cp311-cp311-win_amd64.whl (301.4 kB view details)

Uploaded CPython 3.11Windows x86-64

micromode-0.1.0a4-cp311-cp311-manylinux_2_35_x86_64.whl (434.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

micromode-0.1.0a4-cp311-cp311-macosx_11_0_arm64.whl (383.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

micromode-0.1.0a4-cp311-cp311-macosx_10_12_x86_64.whl (398.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

micromode-0.1.0a4-cp310-cp310-win_amd64.whl (301.5 kB view details)

Uploaded CPython 3.10Windows x86-64

micromode-0.1.0a4-cp310-cp310-manylinux_2_35_x86_64.whl (434.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

micromode-0.1.0a4-cp310-cp310-macosx_11_0_arm64.whl (383.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

micromode-0.1.0a4-cp310-cp310-macosx_10_12_x86_64.whl (398.7 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file micromode-0.1.0a4.tar.gz.

File metadata

  • Download URL: micromode-0.1.0a4.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for micromode-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 9959f3f500791cc78f3319f09f41c641d133df34c3f14fa5382ef15038d1781f
MD5 d3bb6054931c1c7c6b420fa0d9e4b85d
BLAKE2b-256 fb30fdb105f340c2d178135ae759ded414dda377fcb039bca8c0fafbd47322c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4.tar.gz:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: micromode-0.1.0a4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 300.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for micromode-0.1.0a4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 48f4f653a76a015620f11e37cf668a1f950629ddc6b8eaded23bdbda5113e2d5
MD5 6d412c3b18cc2b83e9c13f326ec8c10b
BLAKE2b-256 fa940a5882eb9ccee6cf329ae5fbbbd942bb5625cdd819cb5883c302464447b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ec59eccb0a79e3a0cac0bba1b005223dd3e050fe7a5d2565e172f05604433a0e
MD5 f0b0069bad5fa564695d39b398748f00
BLAKE2b-256 f2c055a3b10edff5b4cf3cba4ebb14ba7323e4eab67783e47bce503504dbfcf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp313-cp313-manylinux_2_35_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b78e216d9a8bb1e9b3440bbfc3b953634bb683e217275594a72e4385dde1569d
MD5 94759de2aa297cf7477ce9f3efe27e6f
BLAKE2b-256 fd5de7befd0caf729dcbef9484b26916ef7db55cb8b4b8d2a3563924acf66457

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9ecd2dc754e3c4e200ba43d823d36702ceb404e27701e60e6af18a3d62692deb
MD5 62655aad8fbc1763a5f7ba4908e8ed53
BLAKE2b-256 17fd0cd7a33e8bf7faf78d29c35d75a0e523a622e49f94f6f5dd06eef220efe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: micromode-0.1.0a4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 300.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for micromode-0.1.0a4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 89d24c60753df2b07a29b286cd09c86f9e96c1d80360f376627a7be9efa3cdbe
MD5 80cfcd80ca9cbeb2568ba6dc7653525a
BLAKE2b-256 1c92ae101ae57156e5144f09088b91ef75c6cbf77ff34cc5a5ac2a4313754df0

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7d5c19c6257d89c6e49c5911ae4128718e48fc1fd2df42fb0581b0fd9b185069
MD5 2e85bc260bbc15f5e4ebe01ca0fa486f
BLAKE2b-256 f9a776942bb17fe8cc96f1089787a9d119c45e1f639494ffb52b2a73d6ea04c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp312-cp312-manylinux_2_35_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d6ad6b69349849803e3944e004c05a592a3a38664b9942c688175360a98bed7
MD5 de75f44fdd7a4f275fa810ee395622e3
BLAKE2b-256 95fa1aa2bc371bb5b2c992e2b5330174b00bcebd46dc751b4ff36c2b04afa07e

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 18ab8f2a983e15d9e016124b3f7a4fee6fa19d23bd7d4b415314d45a74de293a
MD5 3a1f30f8326a6a0b96cfc2d4e8d137cb
BLAKE2b-256 5cb27d049d5f5e61292cedc13b0b914cb3e3acefb05c764c582ac390143820f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: micromode-0.1.0a4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 301.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for micromode-0.1.0a4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3df9cf32d85b27701fc7c18c6cdaf2e545e411a8130a917f653f9e5279bb05cb
MD5 4774fd130d9415a0d0a4acf7bffeef4f
BLAKE2b-256 01f60b0e67d38a05a2dfa9d644ec7bb439e2eb313f0f0fde4c95bc59dcb5fc84

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7ead9f037a49c2594e1e826e0b2fd5ed746bb7351682c8d5f96185ef6829c9cc
MD5 3fb9c14ec12002d40e15008c403fdd74
BLAKE2b-256 2539b1101797a5adc7908890744495fc9a677f640df63f3e245888a95cb12f5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp311-cp311-manylinux_2_35_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b9fae44bac7f8d31d50ce96623e6d53a2194064b493f4ebfc437a396890e89d
MD5 3ba274222ad1b1a138a27bba6c31360a
BLAKE2b-256 f26d09fdc1c395a8801ee2d262ac3f42f158254c5761e22e7dc2fbea56196ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ff06994623ef25bd7d3d700409c43ee9484995076b7e6612f61904c1b69ecd5f
MD5 909fc53b8246ab676ef68efc1a972cd3
BLAKE2b-256 5a88dc7534eb4b36274ca065a345f9ddc191203390eec31b535880cec1eccc42

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: micromode-0.1.0a4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 301.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for micromode-0.1.0a4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 79de3450d425d06760eca2335ba8766c3d51c9ee01b1a2bacb346a564c5bab7c
MD5 a0e2c0aba28f95038f7d17733c0806f6
BLAKE2b-256 4bff5ba7e489246a2c940299418da064be02373138045ee980fcfd71dc42d8f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 981f333858bb9da4961663cac25feb7cb869b224c37d2b2a4382709b8af27e7e
MD5 688e1a656029873d5f69f618ad5eb9d5
BLAKE2b-256 8e392717682f5cfffba91ec5b665bd75b14bcdc9665872d3af4e1efc5eb61025

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp310-cp310-manylinux_2_35_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bdd30bc9bebb39dc40c1ddc26bad0db8a406ad546d20410955e448921e527738
MD5 5e48e452da3b903d36ff2bab2ff69bc0
BLAKE2b-256 8c076741e54d95f9ef50da0c7aa3cea37635887185857ef21aa2fb9a10e21c77

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file micromode-0.1.0a4-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for micromode-0.1.0a4-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9fc1e9d8fe72b058619ac0e9050144b77ebad98c04edb621b1963913f0ad01ac
MD5 45ba1201813dae9e11f00450a18645f3
BLAKE2b-256 c2c6e511201c5290baf169033d40bbc5a407bc84125978f66e26f61b38df6e88

See more details on using hashes here.

Provenance

The following attestation bundles were made for micromode-0.1.0a4-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: publish.yml on QuentinWach/micromode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page