Skip to main content
Ctrl+K
PyFiberModes 1.0.2 documentation - Home PyFiberModes 1.0.2 documentation - Home
  • Start
  • Guide
  • Examples
  • API
  • Resources
  • GitHub
  • PyPI
  • Anaconda
  • Start
  • Guide
  • Examples
  • API
  • Resources
  • GitHub
  • PyPI
  • Anaconda

Section Navigation

  • Examples: API
    • Figure 3.13 of Jacques Bures
    • Comparing two and three layers
    • Dispersion VS core index
    • Effective index VS core index
    • Group index vs core index
    • Group index vs core index
    • Mode fields
    • Mode fields
    • Mode fields
    • Effective index for tapered multi-mode fiber
  • Examples single layer fiber
    • Modal dispersion VS core index
    • Modal dispersion VS core index
    • Modal dispersion VS core index
  • Specialty-fiber examples
    • Refractive-index profile
    • Specialty-fiber catalog
    • Specialty-fiber mode indices
  • Fields and power
    • Confinement by radius
    • Polarization rotation
    • Vector field components
  • Analysis and design
    • Coupled-mode power exchange
    • Guided-mode discovery
    • Structured wavelength sweep
  • Validation
    • Effective-index bounds
    • Effective-area convergence
    • Normalized effective index
  • Benchmarks
    • Component batching
    • Field-grid scaling
    • Modal-cache speedup
  • Example galleries
  • Benchmarks
  • Modal-cache speedup

Note

Go to the end to download the full example code.

Modal-cache speedup#

Compare the first effective-index solution with a repeated lookup served by the geometry-aware modal cache.

Geometry-aware modal cache
from PyFiberModes.units import ureg

from time import perf_counter

import matplotlib.pyplot as plt

from PyFiberModes import LP01
from PyFiberModes.fiber import load_fiber

fiber = load_fiber("SMF28", wavelength=1550e-9 * ureg.meter)
start = perf_counter()
fiber.get_effective_index(LP01)
uncached_time = perf_counter() - start

start = perf_counter()
fiber.get_effective_index(LP01)
cached_time = perf_counter() - start

figure, axis = plt.subplots()
axis.bar(("First solution", "Cached lookup"), (uncached_time, cached_time))
axis.set(ylabel="Elapsed time [s]", title="Geometry-aware modal cache")
plt.show()

Total running time of the script: (0 minutes 0.060 seconds)

Download Jupyter notebook: plot_modal_cache_speedup.ipynb

Download Python source code: plot_modal_cache_speedup.py

Download zipped: plot_modal_cache_speedup.zip

Gallery generated by Sphinx-Gallery

previous

Field-grid scaling

next

API reference

Edit on GitHub
Show Source

© Copyright Martin Poinsinet de Sivry-Houle.