S1 S2 Function Computation#

This example demonstrates how to compute and visualize the S1 and S2 scattering functions using PyMieSim.

S$_1$ parameter, S$_2$ parameter
/opt/hostedtoolcache/Python/3.11.17/x64/lib/python3.11/site-packages/numpy/ma/core.py:2425: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
  a = np.array(a, copy=None, subok=True)
findfont: Font family ['cursive'] not found. Falling back to DejaVu Sans.
findfont: Generic family 'cursive' not found because none of the following families were found: Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive
findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.

import PyOptik
from PyMieSim import from_pyoptik

from PyMieSim import (
    ureg,
    InfiniteCylinder,
    Gaussian,
    PolarizationState,
    Simulation,
)

bk7 = from_pyoptik(PyOptik.load_material(name="specs/SCHOTT-optical/P-BK7"))

polarization_state = PolarizationState(angle=0 * ureg.degree)

source = Gaussian(
    wavelength=450 * ureg.nanometer,
    polarization=polarization_state,
    optical_power=1 * ureg.watt,
    numerical_aperture=0.3,
)

scatterer = InfiniteCylinder(
    diameter=6 * ureg.nanometer,
    medium=1.0,
    material=bk7,
)

setup = Simulation(
    scatterer=scatterer,
    source=source,
)

s1s2 = setup.get_representation("s1s2", sampling=200)

figure = s1s2.plot()

Total running time of the script: (0 minutes 1.305 seconds)

Gallery generated by Sphinx-Gallery