Skip to main content

EMpy - ElectroMagnetic Python

CI PyPI

EMpy - ElectroMagnetic Python is a Python suite of numerical algorithms for electromagnetism, photonics, and integrated optics: isotropic and 4 × 4 anisotropic transfer matrix methods, planar/conical/anisotropic rigorous coupled-wave analysis (RCWA), finite-difference and film-mode-matching waveguide mode solvers, passive and Lorentz-reciprocal waveguide S-matrix cascades, optical ring resonators and coupled-resonator photonic circuits, liquid-crystal electro-optics, and 3D vector diffraction integrals.

What's New in 3.0

  • Unified Passive Electrodynamic Conventions: Consistent exp(+iωt - ik·r) harmonic phase, passive complex refractive index n = n_r - iκ (κ ≥ 0), passive branch-cut selection (Re(k_z) - Im(k_z) ≥ 0) across TIR, plasmonic, and lossy media, and complex-symmetric linear algebra throughout.
  • Stabilized Full-Wave & Multilayer Solvers: ETM-stabilized 4 × 4 Yeh–Berreman AnisotropicTransferMatrix and closed-form Abeles IsotropicTransferMatrix, ETM-stabilized AnisotropicRCWA with Li's inverse-rule factorization, scale-invariant multi-slice FMM1d/FMM2d (SI meters & microns), and Redheffer star-product S-matrix cascades (GenericDevice, passive & reciprocal SimpleJoint).
  • Out-of-the-Box Liquid Crystals & Modern Stack: LiquidCrystalCell solves coupled 1D Oseen–Frank elastic + electrostatic BVPs natively via scipy.integrate.solve_bvp (no scikits.bvp1lg required), targeting Python 3.10–3.14, NumPy 2.x, and SciPy 1.13+.
  • Rigorous Verification: 104-test physics/invariant suite validating closed-form analytical benchmarks (Fresnel/Lekner, Airy/Abeles, CROW Möbius, Yariv critical coupling, Hertzian dipoles, uniaxial slabs), conservation laws (R + T = 1, Sᴴ S = I), passivity (‖S‖₂ ≤ 1), Lorentz reciprocity (S = Sᵀ), and continuous Δn → 0 and κ → 0⁺ degenerate limits.

Implemented Modules

  • EMpy.transfer_matrix: IsotropicTransferMatrix (2 × 2) and AnisotropicTransferMatrix (4 × 4 Yeh–Berreman) for dispersive, lossy, TIR/SPR, and 3D Euler-rotated biaxial multilayers.
  • EMpy.RCWA: IsotropicRCWA and AnisotropicRCWA for planar, conical, and 3D birefringent gratings with Lalanne/Li Fourier factorization and Enhanced Transmittance Matrix (ETM) stabilization.
  • EMpy.modesolvers: Semivectorial (SVFDModeSolver) and 5-component anisotropic full-vectorial (VFDModeSolver) finite-difference solvers with stretchmesh PMLs, FMM1d/FMM2d Film Mode Matching, and S-matrix junctions/cascades (SimpleJoint, SWG, GenericDevice).
  • EMpy.devices: Optical ring resonators (APRR, SRR, NRR microring and CROW filters), tunable multi-coupler ring resonators (T_TCRR, T_CRTCRR, T_CTCRR), directional couplers, delay lines, thermo-optic MZ interferometers, and Etalon.
  • EMpy.materials, EMpy.scattering, EMpy.utils: Sellmeier/polynomial/tabulated/thermo-optic materials, LiquidCrystalCell electro-optic BVP solver, and 3D Kottler–Stratton–Chu vector surface-current scattering (currentsScatteringKottler).

Installation

Requires Python >= 3.10:

pip install ElectroMagneticPython

Development

Managed with uv:

make develop   # install dev environment
make test      # run test suite
make lint      # black --check, flake8, pyflakes, mypy
make black     # format code

Run any benchmark script from examples/ (see examples/README.md):

uv run examples/devices/ex_ring_resonators_aprr_srr_nrr.py

Or launch the interactive Google Colab notebooks directly in your browser.

Commercial Support, Consulting & Sponsorship

EMpy is free and open-source under the MIT License. If your team uses EMpy in R&D or production, commercial services are available from the author (code@lbolla.info):

  • Custom Modeling & Optimization: Grating/metasurface design (AnisotropicRCWA), liquid-crystal & birefringent stack modeling (LiquidCrystalCell, AnisotropicTransferMatrix), waveguide mode/circuit simulation (FD, FMM, devices), and fitting models to experimental data.
  • Integration & Feature Development: Embedding EMpy into internal Python/CI workflows, porting legacy MATLAB scripts, or developing custom solver features and material models.
  • Support Retainers & Sponsorships: Priority bug fixes, upgrade support, and engineering office hours—or sponsor ongoing maintenance via GitHub Sponsors.

Citation

If you find EMpy useful in your work, please consider citing it:

Bolla, L. (2017). EMpy [Computer software]. https://github.com/lbolla/EMpy/

Or in text:

We used EMpy (version x.y.z) to complete our work.

Metadata

Release files for ElectroMagneticPython 3.0.2

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

Source distribution (sdist)

Source distribution for ElectroMagneticPython 3.0.2
File Size Uploaded Provenance Actions
electromagneticpython-3.0.2.tar.gz 335.6 kB Without provenance Details for electromagneticpython-3.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ElectroMagneticPython 3.0.2
File Interpreter ABI Platform Actions
electromagneticpython-3.0.2-py3-none-any.whl Python 3 none any Details for electromagneticpython-3.0.2-py3-none-any.whl

Total release size: 582.6 kB

Release files / electromagneticpython-3.0.2.tar.gz

Download URL electromagneticpython-3.0.2.tar.gz
Size 335.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a79c8fbb57673d323d57fbe6c22a6a25e865fe28b3ed054ce744189867f3f901
BLAKE2b-256 checksum
How to use checksums
14569f6cf3468c30cde732a8e4467a37b4acffc9349b4f1f47cfe002254864a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / electromagneticpython-3.0.2-py3-none-any.whl

Download URL electromagneticpython-3.0.2-py3-none-any.whl
Size 247.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
645e7b631e379b0caf39397c4709dd3e1ed117eff2bfcc1f3b01b5043f63e94a
BLAKE2b-256 checksum
How to use checksums
06f5cae475f6e01f5e60367c4e4be05e840209e9a1802a2fefb1fae2814e1f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ElectroMagneticPython 3.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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