.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/single/scatterer/farfield.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_farfield.py: Far-Fields Computation and Visualization ======================================== This example demonstrates the process of computing and visualizing the far-fields of a scatterer 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=1000 * nanometer, # 1000 nm polarization=30 * 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=1500 * nanometer, # 1500 nm source=source, property=1.4 * RIU, # Refractive index of the scatterer medium_property=1.0 * RIU # Refractive index of the surrounding medium ) .. GENERATED FROM PYTHON SOURCE LINES 33-34 Computing the data .. GENERATED FROM PYTHON SOURCE LINES 34-36 .. code-block:: Python data = scatterer.get_far_field(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_farfield_001.png :alt: farfield :srcset: /gallery/single/scatterer/images/sphx_glr_farfield_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.722 seconds) .. _sphx_glr_download_gallery_single_scatterer_farfield.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: farfield.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: farfield.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: farfield.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_