EMpy - ElectroMagnetic Python
EMpy - ElectroMagnetic Python is a Python suite of numerical algorithms for electromagnetism, photonics, and integrated optics: isotropic and 4 × 4 anisotropic transfer matrices, 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, coupled-resonator photonic circuits, liquid-crystal electro-optics, and 3D vector diffraction integrals.
- Homepage & Documentation: https://lbolla.github.io/EMpy/
- Methodology & Literature References: https://lbolla.github.io/EMpy/methodology/
- Examples Gallery (22 literature benchmarks): https://lbolla.github.io/EMpy/examples/ (also in
examples/) - Release Notes: CHANGELOG.md
What's New in 3.0
- Unified Passive Electrodynamic Conventions: Consistent
exp(+iωt - ik·r)harmonic phase, passive complex refractive indexn = 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
AnisotropicTransferMatrixand closed-form AbelesIsotropicTransferMatrix, ETM-stabilizedAnisotropicRCWAwith Li's inverse-rule factorization, scale-invariant multi-sliceFMM1d/FMM2d(SI meters & microns), and Redheffer star-product S-matrix cascades (GenericDevice, passive & reciprocalSimpleJoint). - Out-of-the-Box Liquid Crystals & Modern Stack:
LiquidCrystalCellsolves coupled 1D Oseen–Frank elastic + electrostatic BVPs natively viascipy.integrate.solve_bvp(noscikits.bvp1lgrequired), 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 → 0andκ → 0⁺degenerate limits.
Implemented Modules
EMpy.transfer_matrix:IsotropicTransferMatrix(2 × 2) andAnisotropicTransferMatrix(4 × 4 Yeh–Berreman) for dispersive, lossy, TIR/SPR, and 3D Euler-rotated biaxial multilayers.EMpy.RCWA:IsotropicRCWAandAnisotropicRCWAfor 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 withstretchmeshPMLs,FMM1d/FMM2dFilm Mode Matching, and S-matrix junctions/cascades (SimpleJoint,SWG,GenericDevice).EMpy.devices: Directional couplers, delay lines, thermo-opticMZinterferometers,APRR/SRR/NRRmicroring filters, tunable multi-coupler rings (T_TCRR,T_CRTCRR,T_CTCRR), andEtalon.EMpy.materials,EMpy.scattering,EMpy.utils: Sellmeier/polynomial/tabulated/thermo-optic materials,LiquidCrystalCellelectro-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
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
EMpyinto 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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| electromagneticpython-3.0.1.tar.gz | 323.8 kB | Without provenance | Details for electromagneticpython-3.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| electromagneticpython-3.0.1-py3-none-any.whl | Python 3 | none | any | Details for electromagneticpython-3.0.1-py3-none-any.whl |
Total release size: 555.5 kB
Release files / electromagneticpython-3.0.1.tar.gz
| Download URL | electromagneticpython-3.0.1.tar.gz |
|---|---|
| Size | 323.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d5e753b4d6c522ecd52a9a82ef95b79df33a255fc16f20f42132cb2cdf1851e
|
|
BLAKE2b-256 checksum How to use checksums |
1b1af85fbbd80c57654bf77a38d076959a861bc8de7681162bbd2fab41b4fd85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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.1-py3-none-any.whl
| Download URL | electromagneticpython-3.0.1-py3-none-any.whl |
|---|---|
| Size | 231.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e67a6ccd01ffc01d5ba7d392871b936cf3b6607a5bdee6a92ea8cebab4d5c3af
|
|
BLAKE2b-256 checksum How to use checksums |
21836957a607f463cbc6b279967306ea38b2cb1d06d285560ca3c20cf911dac5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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.1
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.