Note
Go to the end to download the full example code.
Polarization rotation#
Rotate the fundamental vector mode without recomputing its shared radial solution.

from PyFiberModes.units import ureg
import matplotlib.pyplot as plt
import numpy as np
from PyFiberModes import HE11
from PyFiberModes.fiber import load_fiber
fiber = load_fiber("SMF28", wavelength=1550e-9 * ureg.meter)
field = fiber.get_mode_field(HE11, limit=12e-6 * ureg.meter, n_point=121)
angles = (0, np.pi / 4, np.pi / 2)
figure, axes = plt.subplots(1, 3, figsize=(9, 3), constrained_layout=True)
for axis, angle in zip(axes, angles):
component = field.Ex(theta=angle * ureg.radian).to("volt / meter").magnitude.real
limit = np.max(np.abs(component))
image = axis.imshow(component, origin="lower", cmap="RdBu_r", vmin=-limit, vmax=limit)
axis.set_title(f"θ = {angle / np.pi:.2g}π")
axis.set_axis_off()
figure.colorbar(image, ax=axes, shrink=0.75, label="Electric-field amplitude")
plt.show()
Total running time of the script: (0 minutes 0.358 seconds)