.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/fields/plot_polarization_rotation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_fields_plot_polarization_rotation.py: Polarization rotation ===================== Rotate the fundamental vector mode without recomputing its shared radial solution. .. GENERATED FROM PYTHON SOURCE LINES 8-29 .. image-sg:: /gallery/fields/images/sphx_glr_plot_polarization_rotation_001.png :alt: θ = 0π, θ = 0.25π, θ = 0.5π :srcset: /gallery/fields/images/sphx_glr_plot_polarization_rotation_001.png :class: sphx-glr-single-img .. code-block:: Python 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() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.358 seconds) .. _sphx_glr_download_gallery_fields_plot_polarization_rotation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_polarization_rotation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_polarization_rotation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_polarization_rotation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_