.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/extras/plot_system.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_extras_plot_system.py: Plot system =========== Example Script: Using the `plot_system` Function This script demonstrates how to use the `plot_system` function to create a 3D visualization of a system consisting of a light source, a scatterer, and a detector. The function leverages PyVista for rendering the 3D scene. This script is intended to be used in conjunction with the Read the Docs documentation. .. GENERATED FROM PYTHON SOURCE LINES 13-56 .. image-sg:: /gallery/extras/images/sphx_glr_plot_system_001.png :alt: plot system :srcset: /gallery/extras/images/sphx_glr_plot_system_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none | .. code-block:: Python from math import sqrt from PyMieSim.units import ureg from PyMieSim.single.scatterer import InfiniteCylinder from PyMieSim.single.source import Gaussian, PolarizationState from PyMieSim.single.detector import CoherentMode from PyMieSim.single import SystemPlotter from PyMieSim.single.representations import SPF polarization_state = PolarizationState( angle=0 * ureg.degree, # Linear polarization at 0 degrees ) source = Gaussian( wavelength=1550 * ureg.nanometer, # Wavelength of 1550 nm polarization=polarization_state, # Linear polarization at 0 degrees optical_power=1 * ureg.watt, # Optical power in arbitrary units numerical_aperture=0.3 * ureg.AU, # Numerical Aperture ) scatterer = InfiniteCylinder( diameter=7800 * ureg.nanometer, # Diameter of 7.8 micrometers source=source, # The Gaussian source defined above medium_refractive_index=1.0 * ureg.RIU, # Refractive index of the surrounding medium refractive_index=sqrt(1.5) * ureg.RIU, # Refractive index of the scatterer ) detector = CoherentMode( mode_number="LP01", numerical_aperture=0.2 * ureg.AU, # Numerical Aperture gamma_offset=0 * ureg.degree, # Gamma offset in degrees phi_offset=60 * ureg.degree, # Phi offset in degrees rotation=0 * ureg.degree, # Rotation angle in degrees polarization_filter=0 * ureg.degree, # Polarization filter angle in degrees ) spf = SPF(scatterer=scatterer) plotter = SystemPlotter(show_axis_label=False) plotter.plot(source, scatterer, detector, data=spf) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.274 seconds) .. _sphx_glr_download_gallery_extras_plot_system.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_system.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_system.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_system.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_