| Meta | |||
| Testing | |||
| PyPI | |||
| Anaconda |
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.
- 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.experiment.scatterer_set import SphereSet
from PyMieSim.experiment.source_set import GaussianSet
from PyMieSim.experiment.polarization_set import PolarizationSet
from PyMieSim.experiment import Setup
from PyMieSim.units import ureg
import numpy as np
polarization = PolarizationSet(
angles=[0] * ureg.degree
)
source = GaussianSet(
wavelength=np.linspace(400, 2000, 500) * ureg.nanometer,
polarization=polarization,
optical_power=1e-3 * ureg.watt,
numerical_aperture=0.2 * ureg.AU,
)
scatterer = SphereSet(
diameter=[200, 300] * ureg.nanometer,
material=[4 + 1j] * ureg.RIU,
medium=[1] * ureg.RIU,
)
experiment = Setup(
scatterer_set=scatterer,
source_set=source
)
df = experiment.get("Qsca", "Qext")
df.plot(x="source:wavelength")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.


