.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/interfaces/plot_fresnel_angles.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_interfaces_plot_fresnel_angles.py: Fresnel reflectance versus incidence angle ========================================== Compare s and p polarization at an air-to-glass interface and identify the Brewster angle where p-polarized reflection vanishes. .. GENERATED FROM PYTHON SOURCE LINES 10-28 .. code-block:: Python import matplotlib.pyplot as plt import numpy from TypedUnit import ureg from PyOptik import brewster_angle, fresnel_coefficients angles = numpy.linspace(0, 89, 500) * ureg.degree reflectance_s = numpy.array([ fresnel_coefficients(1.0, 1.5, angle, polarization="s").reflectance for angle in angles ]) reflectance_p = numpy.array([ fresnel_coefficients(1.0, 1.5, angle, polarization="p").reflectance for angle in angles ]) brewster = brewster_angle(1.0, 1.5).to(ureg.degree).magnitude .. GENERATED FROM PYTHON SOURCE LINES 29-43 .. code-block:: Python figure, axis = plt.subplots(layout="constrained") axis.plot(angles.magnitude, reflectance_s, label="s polarization") axis.plot(angles.magnitude, reflectance_p, label="p polarization") axis.axvline(brewster, color="black", linestyle="--", label=f"Brewster: {brewster:.1f}°") axis.set( xlabel="Incidence angle [degree]", ylabel="Reflectance", title="Air–glass Fresnel reflectance", xlim=(0, 90), ylim=(0, 1), ) axis.grid(alpha=0.25) axis.legend() plt.show() .. image-sg:: /gallery/interfaces/images/sphx_glr_plot_fresnel_angles_001.png :alt: Air–glass Fresnel reflectance :srcset: /gallery/interfaces/images/sphx_glr_plot_fresnel_angles_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.320 seconds) .. _sphx_glr_download_gallery_interfaces_plot_fresnel_angles.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_fresnel_angles.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_fresnel_angles.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_