.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/experiment/sphere/independent_size_distribution.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_experiment_sphere_independent_size_distribution.py: Size distribution: independent scattering only ============================================== Average isolated-sphere cross sections over a lognormal number distribution. This is the non-interacting approximation: no interparticle electromagnetic coupling, multiple scattering, positional correlations, or interference between particles is modeled. The result is a mean per particle, not a sample total. .. GENERATED FROM PYTHON SOURCE LINES 10-48 .. image-sg:: /gallery/experiment/sphere/images/sphx_glr_independent_size_distribution_001.png :alt: Lognormal sizes — non-interacting particles only :srcset: /gallery/experiment/sphere/images/sphx_glr_independent_size_distribution_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from PyMieSim import ( Measure, Experiment, ParticleSizeDistribution, PlaneWaveSet, PolarizationSet, SphereSet, ureg, ) source = PlaneWaveSet( wavelength=np.linspace(400, 800, 40) * ureg.nanometer, polarization=PolarizationSet(angles=0 * ureg.degree), amplitude=[1] * ureg.volt / ureg.meter, ) figure, axis = plt.subplots() for sampling in (16, 32, 64): distribution = ParticleSizeDistribution.lognormal( median_diameter=150 * ureg.nanometer, geometric_std=1.25, sampling=sampling, ) experiment = Experiment( source_set=source, scatterer_set=SphereSet(diameter=distribution.diameters, material=[1.5], medium=[1.0]), ) result = experiment.average_size_distribution( distribution, Measure.CSCA, as_result=True, ).to("nanometer ** 2") axis.plot(result.coords["source:wavelength"] * 1e9, result.magnitude, label=f"{sampling} quadrature nodes" ) axis.set( xlabel="Wavelength [nm]", ylabel="Mean scattering cross section per particle [nm²]", title="Lognormal sizes — non-interacting particles only" ) axis.legend() figure.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.162 seconds) .. _sphx_glr_download_gallery_experiment_sphere_independent_size_distribution.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: independent_size_distribution.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: independent_size_distribution.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: independent_size_distribution.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_