.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/experiment/sphere/size_distribution_families.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_size_distribution_families.py: Compare size distribution families ================================== Number-based size populations averaged in the non-interacting approximation. No interparticle coupling, multiple scattering, or interparticle interference is included. Refer to PackLab for correlation-based dependent-scattering approximations when particle correlations matter. .. GENERATED FROM PYTHON SOURCE LINES 10-47 .. image-sg:: /gallery/experiment/sphere/images/sphx_glr_size_distribution_families_001.png :alt: Size distributions — non-interacting particles :srcset: /gallery/experiment/sphere/images/sphx_glr_size_distribution_families_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from PyMieSim import Measure, Experiment, ParticleSizeDistribution, PlaneWaveSet, PolarizationSet, SphereSet, ureg sizes = ParticleSizeDistribution populations = { "Monodisperse": sizes.monodisperse(200 * ureg.nanometer), "Uniform": sizes.uniform(100 * ureg.nanometer, 300 * ureg.nanometer), "Lognormal": sizes.lognormal(200 * ureg.nanometer, 1.2), "Truncated normal": sizes.truncated_normal( 200 * ureg.nanometer, 40 * ureg.nanometer, minimum_diameter=100 * ureg.nanometer, maximum_diameter=300 * ureg.nanometer, ), "Triangular": sizes.triangular(100 * ureg.nanometer, 200 * ureg.nanometer, 300 * ureg.nanometer), } populations["Mixture (75% / 25%)"] = sizes.mixture( [sizes.monodisperse(100 * ureg.nanometer), populations["Uniform"]], [3, 1], ) 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 label, distribution in populations.items(): 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=label) axis.set(xlabel="Wavelength [nm]", ylabel="Mean scattering cross section per particle [nm²]", title="Size distributions — non-interacting particles") axis.legend() figure.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.193 seconds) .. _sphx_glr_download_gallery_experiment_sphere_size_distribution_families.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: size_distribution_families.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: size_distribution_families.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: size_distribution_families.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_