| Badge | Status |
|---|---|
| Python versions | |
| Documentation | |
| Scientific article | |
| Continuous integration | |
| Test coverage | |
| Google Colab | |
| PyPI package | |
| PyPI downloads | |
| Anaconda package | |
| Anaconda downloads | |
| Latest Anaconda release |
PyMieSim is an open-source Python package for fast and flexible Mie scattering simulations. It supports spherical, cylindrical and core--shell particles and provides helper classes for custom sources and detectors. The project targets both quick single-scatterer studies and large parametric experiments.
Try the live web GUI: PyMieSim Parameter Sweep Lab.
- Solvers for spheres, cylinders and core--shell geometries.
- Built-in models for plane wave and Gaussian sources.
- Multiple detector types including photodiodes and coherent modes.
- Simple data analysis with pandas DataFrame outputs.
PyMieSim is available on PyPI and Anaconda. Install it with:
pip install PyMieSim
conda install PyMieSim --channels MartinPdeSSee the online documentation for detailed usage and additional examples.
Below is a short example computing the scattering efficiency of a sphere.
from PyMieSim import Gaussian, PolarizationState, Simulation, Sphere, ureg
source = Gaussian(
wavelength=750 * ureg.nanometer,
polarization=PolarizationState(angle=0 * ureg.degree),
optical_power=1e-3 * ureg.watt,
numerical_aperture=0.2,
)
scatterer = Sphere(
diameter=200 * ureg.nanometer,
material=4 + 1j,
medium=1.0,
)
simulation = Simulation(scatterer=scatterer, source=source)
qsca = simulation.run("Qsca")
print(qsca)For wavelength, size, or material sweeps, use the experiment API described in the experiment examples.
Here is the architecture for a standard workflow using PyMieSim:
For development or manual compilation, clone the repository and run:
git submodule update --init
mkdir build && cd build
cmake ../ -G"Unix Makefiles"
sudo make install
cd ..
python -m pip install .Run the unit tests with:
pip install PyMieSim[testing]
pytestIf you use PyMieSim in academic work, please cite:
@article{PoinsinetdeSivry-Houle:23,
author = {Martin Poinsinet de Sivry-Houle and Nicolas Godbout and Caroline Boudoux},
journal = {Opt. Continuum},
title = {PyMieSim: an open-source library for fast and flexible far-field Mie scattering simulations},
volume = {2},
number = {3},
pages = {520--534},
year = {2023},
doi = {10.1364/OPTCON.473102},
}
For questions or contributions, contact martin.poinsinet.de.sivry@gmail.com.


