| Badge | Status |
|---|---|
| Python versions | |
| Documentation | |
| Tests | |
| PyPI | |
| Conda |
A package for light scattering (Mie) computation.
Calculate scattering by spheres, coated spheres, and cylinders. Specify the incident field, particle geometry, and optical material, then sweep one input to see how scattering efficiency or detector coupling changes.
See the usage guide for further examples and implementation details. Open the project notebook in Colab.
Requires Python >=3.10.
$ python -m pip install PyMieSimInstall from the martinpdes Conda channel:
$ conda install -c martinpdes pymiesimFor an editable source installation:
$ git clone https://github.com/MartinPdeS/PyMieSim.git $ cd PyMieSim $ python -m pip install -e .
""" Sphere: Qsca vs diameter ======================== """ import PyOptik from PyMieSim import from_pyoptik import numpy as np from PyMieSim import ( Measure, ureg, SphereSet, GaussianSet, PolarizationSet, MaterialSet, MediumSet, Experiment, ) polarization_set = PolarizationSet( angles=[0.0] * ureg.degree, ) source = GaussianSet( wavelength=[405] * ureg.nanometer, polarization=polarization_set, optical_power=[1e-3] * ureg.watt, numerical_aperture=[0.2], ) bk7 = from_pyoptik(PyOptik.load_material(name="specs/SCHOTT-optical/P-BK7")) scatterer = SphereSet( diameter=np.linspace(10, 1000, 150) * ureg.nanometer, material=MaterialSet(materials=[bk7]), medium=MediumSet(refractive_indices=[1.33, 1.34, 1.5]), ) experiment = Experiment(scatterer_set=scatterer, source_set=source) result = experiment.run(Measure.QSCA) print("Result dimensions and shape:", result.dims, result.shape) print("Measure units:", result.units) result.plot(x="scatterer:diameter", show=True)
Use the PyMieSim documentation to work through examples and look up the inputs and return values of individual functions.
For the scattering model and its validation, cite the PyMieSim paper in Optics Continuum.
Bug reports, worked examples, and documentation corrections are welcome. To set up a development checkout and run the tests, follow the contributing guide.
For questions, contact Martin Poinsinet de Sivry-Houle.
See the PyMieSim license for terms of use.

