Computing Optical Fiber Modes Using
|
![]() Logo made by Gemini |
Capabilities#
Semi-analytical methods
LP modes of step-index fibers via characteristic equations and Bessel functions —
StepIndexExactScalar and vector leaky modes of Bragg fibers via the transfer matrix method —
BraggExactScalar,BraggExactVector
Numerical methods (FEM + FEAST)
Guided and leaky modes (scalar and vector) of arbitrary fiber geometries, including
step-index fibers —
StepIndex,Bragg fibers —
Bragg,antiresonant fibers —
ARF,NANF,photonic bandgap fibers —
PBG.
Key algorithmic features include the FEAST polynomial eigensolver with contour integration in the complex plane, a frequency-dependent PML for accurate leaky mode eigenvalues, nondimensional Z-plane formulation to avoid numerical round-off in large eigenvalue problems, confinement loss (dB/m) computed directly from complex propagation constants, and mode visualization tools.
Installation#
git clone git@github.com:jayggg/fibermode.git
cd fibermode
pip install -e .
pip install -e . installs fibermode in editable mode and pulls in
its PyPI dependencies (numpy, scipy, matplotlib, sympy,
cxroots) automatically. Two dependencies are deliberately left out
of install_requires and must be managed yourself:
NGSolve, a high-performance finite element library. Most users already have NGSolve installed (conda, a source build, or an MPI/MKL-enabled build) —
pip install ngsolvewould fetch an unrelated plain-PyPI copy that can shadow or conflict with it, so it’s intentionally not listed. If you don’t have NGSolve yet,pip install ngsolveis fine.pyeigfeast, which implements the FEAST polynomial eigensolver for NGSolve. It has no PyPI release and no
setup.py, sopipcannot install it regardless — clone it and add it to yourPYTHONPATH:git clone git@bitbucket.org:jayggg/pyeigfeast.git export PYTHONPATH="$PWD/pyeigfeast:$PYTHONPATH"
(If you don’t want an editable install, pip install . works too, but
since this is an actively developed research codebase, -e is
recommended so local edits take effect without reinstalling.)
Quick start#
from fibermode import StepIndexExact, StepIndex, Bragg, BraggExactScalar
# Semi-analytical LP modes of a named fiber
f = StepIndexExact('Nufern_Yb')
betas = f.XtoBeta(f.propagation_constants(ell=0))
# Numerical guided modes (FEM + FEAST)
fiber = StepIndex(fibername='Nufern_Yb')
betas, zsqrs, modes = fiber.guidedmodes(p=3)
Further simple demos are available at the demos folder.
Documentation & Tutorial Notebooks#
Browse tutorial notebooks online. The notebooks can also be found in the docs folder. Additionally, the demos folder contain simple python scripts.
Cite#
If you use fibermode in your research or teaching, please cite it:
@misc{fibermode,
author = {Gopalakrishnan, Jay},
title = {Computing Optical Fiber Modes Using \texttt{fibermode}},
howpublished = {\url{https://github.com/jayggg/fibermode}},
year = {2026}
}
License#
Write to Jay Gopalakrishnan for consultations, bug reports and suggestions. Pull requests are welcome at jayggg/fibermode. Code and documentation are released under the MIT License.
