.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/single/scatterer/stokes.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_single_scatterer_stokes.py: Stokes Parameters Computation ============================= This example demonstrates the computation and visualization of the Stokes parameters using PyMieSim. .. GENERATED FROM PYTHON SOURCE LINES 9-10 Importing the package: PyMieSim .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python from PyMieSim.single.scatterer import Sphere from PyMieSim.single.source import Gaussian from PyMieSim.units import nanometer, degree, watt, AU, RIU .. GENERATED FROM PYTHON SOURCE LINES 15-16 Defining the source .. GENERATED FROM PYTHON SOURCE LINES 16-23 .. code-block:: Python source = Gaussian( wavelength=750 * nanometer, # 750 nm polarization=10 * degree, # Right circular polarization optical_power=1 * watt, # Arbitrary units NA=0.3 * AU # Numerical Aperture ) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Defining the scatterer .. GENERATED FROM PYTHON SOURCE LINES 25-32 .. code-block:: Python scatterer = Sphere( diameter=300 * nanometer, # 300 nm source=source, medium_property=1.0 * RIU, # Refractive property of the surrounding medium property=1.4 * RIU # Refractive property of the scatterer ) .. GENERATED FROM PYTHON SOURCE LINES 33-34 Computing the data .. GENERATED FROM PYTHON SOURCE LINES 34-36 .. code-block:: Python data = scatterer.get_stokes(sampling=100) # Specify the number of sampling points .. GENERATED FROM PYTHON SOURCE LINES 37-38 Plotting the data .. GENERATED FROM PYTHON SOURCE LINES 38-39 .. code-block:: Python figure = data.plot() .. image-sg:: /gallery/single/scatterer/images/sphx_glr_stokes_001.png :alt: stokes :srcset: /gallery/single/scatterer/images/sphx_glr_stokes_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.336 seconds) .. _sphx_glr_download_gallery_single_scatterer_stokes.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: stokes.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: stokes.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: stokes.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_