.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/structured_media/illumination_polarization.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_auto_examples_structured_media_illumination_polarization.py: Oblique illumination and linear, circular, and elliptical polarization ====================================================================== Illuminate the same anisotropic dielectric particle with different plane waves. Propagation and electric-field vectors are specified in laboratory coordinates. A PolarizationState supplies a linear angle or complex Jones vector; omitting it selects unpolarized illumination. LeftCircular uses (1, +i)/sqrt(2), matching PyMieSim, with time convention exp(-i omega t). The observation grid stays fixed in the laboratory frame. The plotted angle is measured from laboratory +z, whereas anisotropy g uses the angle relative to each incident beam. This third-order example retains the linearized contrast and spherical Green self cell; it is not a general strong-scattering solution. Refine geometry, quadrature, and Born order for quantitative work. .. GENERATED FROM PYTHON SOURCE LINES 17-46 .. code-block:: Python import matplotlib.pyplot as plt from bornsim import AngularSampling, Ellipsoid, Grid, LeftCircular, PolarizationState, Solver, Source, StructuredMedium from bornsim.units import ureg particle = Ellipsoid( radii=[80, 40, 60] * ureg.nanometer, refractive_index=1.35, ) medium = StructuredMedium() medium.add_background(refractive_index=1.33) medium.add_structures(particle) grid = Grid( shape=(12, 12, 12), spacing=20 * ureg.nanometer, ) volume = medium.to_volume(grid=grid) volume_figure = volume.plot_3d( field="refractive_index", ) .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 48-55 Define Jones states for an oblique incident beam ------------------------------------------------- For direction (0.6, 0, 0.8), the real transverse basis is (0.8, 0, -0.6) and (0, 1, 0). Circular polarization combines them with equal magnitudes and a pi/2 relative phase; elliptical uses unequal magnitudes. Jones vectors are normalized by PolarizationState; no manual square roots or Cartesian projections are needed. .. GENERATED FROM PYTHON SOURCE LINES 55-109 .. code-block:: Python linear_state = PolarizationState(angle=90 * ureg.degree) circular_state = LeftCircular() elliptical_state = PolarizationState(jones_vector=[1, 0.5j]) unpolarized_source = Source(wavelength=633 * ureg.nanometer) linear_source = Source( wavelength=633 * ureg.nanometer, incident_direction=[0.6, 0, 0.8], polarization=linear_state, ) circular_source = Source( wavelength=633 * ureg.nanometer, incident_direction=[0.6, 0, 0.8], polarization=circular_state, ) elliptical_source = Source( wavelength=633 * ureg.nanometer, incident_direction=[0.6, 0, 0.8], polarization=elliptical_state, ) sampling = AngularSampling( n_points=91, polar_samples=24, azimuth_samples=16, ) results = [] for label, source in ( ("Unpolarized, +z", unpolarized_source), ("Linear, oblique", linear_source), ("Circular, oblique", circular_source), ("Elliptical, oblique", elliptical_source), ): solver = Solver( source=source, sampling=sampling, order=3, ) result = solver.solve(target=volume) results.append((label, result)) print(f"{label}: third-order cross section = {(result.mu_s[-1] * result.sample_volume).to('nanometer**2')}") print(f"{label}: third-order anisotropy relative to its beam = {result.g[-1]}") .. rst-class:: sphx-glr-script-out .. code-block:: none Unpolarized, +z: third-order cross section = 0.8947924384129596 nanometer ** 2 Unpolarized, +z: third-order anisotropy relative to its beam = 0.10533852643605794 dimensionless Linear, oblique: third-order cross section = 0.8521253909792561 nanometer ** 2 Linear, oblique: third-order anisotropy relative to its beam = 0.13215028325413666 dimensionless Circular, oblique: third-order cross section = 0.8675661587157821 nanometer ** 2 Circular, oblique: third-order anisotropy relative to its beam = 0.131010764143171 dimensionless Elliptical, oblique: third-order cross section = 0.8768306193576978 nanometer ** 2 Elliptical, oblique: third-order anisotropy relative to its beam = 0.13034631665706153 dimensionless .. GENERATED FROM PYTHON SOURCE LINES 110-114 Compare one physical laboratory meridian ----------------------------------------- This meridian is phi=0 for every source. It is not an azimuth average. For the oblique sources, the forward direction is theta=36.87 degrees. .. GENERATED FROM PYTHON SOURCE LINES 114-131 .. code-block:: Python figure, axis = plt.subplots(layout="constrained") for label, result in results: cross_section = result.differential_cross_section.to("nanometer**2 / steradian") axis.plot(result.angles.to("degree").magnitude, cross_section.magnitude[-1, :, 0], label=label) axis.set( xlabel="Laboratory polar angle (degrees), azimuth 0°", ylabel="Differential cross section (nm² sr⁻¹)", title="Same particle, third cumulative Born order", ) axis.legend() plt.show() .. image-sg:: /auto_examples/structured_media/images/sphx_glr_illumination_polarization_001.png :alt: Same particle, third cumulative Born order :srcset: /auto_examples/structured_media/images/sphx_glr_illumination_polarization_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 132-138 Outgoing amplitudes for a pure polarization state --------------------------------------------------- Pure illumination retains one incident mode, rather than two unpolarized modes. The final axis holds laboratory x, y, z field components in metres. These complex amplitudes can be projected onto an outgoing transverse analyzer before squaring to study polarization-resolved detection. .. GENERATED FROM PYTHON SOURCE LINES 138-139 .. code-block:: Python print(f"Circular-source amplitude array shape: {results[2][1].amplitudes.shape}") .. rst-class:: sphx-glr-script-out .. code-block:: none Circular-source amplitude array shape: (3, 91, 16, 1, 3) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.795 seconds) .. _sphx_glr_download_auto_examples_structured_media_illumination_polarization.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: illumination_polarization.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: illumination_polarization.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: illumination_polarization.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_