Skip to main content

PyOptik logo

Badge

Status

Python versions

Python

Documentation

Documentation Status

Scientific article

Scientific article

Continuous integration

Unittest Status

Test coverage

Unittest coverage

Google Colab

Google Colab

PyPI package

PyPI version

PyPI downloads

PyPI downloads

Anaconda package

Anaconda version

Anaconda downloads

Anaconda downloads

Latest Anaconda release

Latest release date

PyMieSim

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.

Features

  • 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.

Installation

PyMieSim is available on PyPI and Anaconda. Install it with:

pip install PyMieSim
conda install PyMieSim  --channels MartinPdeS

See the online documentation for detailed usage and additional examples.

Quick example

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.

Scattering efficiency of a 200 nm sphere with refractive index 4.0.

Code structure

Here is the architecture for a standard workflow using PyMieSim:

Code structure of a standard workflow using PyMieSim.

Building from source

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 .

Testing

Run the unit tests with:

pip install PyMieSim[testing]
pytest

Citing PyMieSim

If 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},
}

Contact

For questions or contributions, contact martin.poinsinet.de.sivry@gmail.com.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymiesim-5.2.0-cp313-cp313-win_amd64.whl (12.4 MB view details)

Uploaded CPython 3.13Windows x86-64

pymiesim-5.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.2.0-cp313-cp313-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

pymiesim-5.2.0-cp312-cp312-win_amd64.whl (12.4 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.2.0-cp312-cp312-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

pymiesim-5.2.0-cp311-cp311-win_amd64.whl (12.3 MB view details)

Uploaded CPython 3.11Windows x86-64

pymiesim-5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.2.0-cp311-cp311-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

File details

Details for the file pymiesim-5.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 12.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymiesim-5.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5c40b13126f2284c814ebf77a2aa3d5067fa47a3955c0edf3e19e20666ff2507
MD5 7d2c7240c92e9fca372ceb4425e620bf
BLAKE2b-256 0b5a8c9c9c5f2f3cd89e3f6426d5959981b1ef68c6d43b2e478e9e948b1f7b26

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0d51a1e46cc064195d0e6306ec3f274bd618f0d573be14c6204a794193174414
MD5 526db06e3628a410086daffd2dbf5c49
BLAKE2b-256 577d7cfa2dc2b0bc7efcc5e039c93532972dc37bc3655f940451fd54a866d926

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp313-cp313-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 19fdf3ef7ec4717d0c7f532cf5bf4f549cc808219f5f1a8958b467461c7ac941
MD5 2fe9b5032a432379b97221fc3b2917cd
BLAKE2b-256 9f99a7c1ef61c7a6b58de2e4ea84e5e3ffee441d8cbbfb87f1d72bf24690970a

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymiesim-5.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 36a618178e8e77822e24b800cd5e426a81c3c7686a20b01706daf3a7ad44a94c
MD5 2d6d36803e7e24320094fdc384c42e0c
BLAKE2b-256 59ece7b247dcd24212a1404f31e7b323a8600b49d7978711c257163c4fff28ef

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7a8b59896888bc09d4a855ea176f03dcc52f8f756b50ba9a95a0a2d0d2425ffc
MD5 383f76063da0654acf2a0be64ac1bb60
BLAKE2b-256 2e29a2f4eec87870953ae85811568a95aced84620d542a5ada2aee4a0f108a8e

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 fe7573285611d4f41f3b904c8efae616cb9785bdf857f43ebb781ec662da948f
MD5 c8ba0efd373f20503c9e3316a1476e76
BLAKE2b-256 a575f5c7c7ef61523f22427452fc28ad5cf2930957ebf306bfa03dd1e190faf8

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pymiesim-5.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 663a9a0420b2cb3fa6c9b4cd82b210e2ade9b3b55fd13d1ea68f6400656fb7ac
MD5 3796f344c554a6539f25bb93c7a8639b
BLAKE2b-256 9e03ea89b44e0cc69dda883dfa4fb83f0fe3c48993007edbb0ea25def4c7a8d6

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a542c375baa31b3e30c9c07fed32345aef06ff29188db9ae57aee518f2c2f864
MD5 a817a54d24ce99830f8e684bacacaf1e
BLAKE2b-256 14ebc795f56e4eb4e89a3b42d30a04a5c679d1cbac341b664346d701234f4e02

See more details on using hashes here.

File details

Details for the file pymiesim-5.2.0-cp311-cp311-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.2.0-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 044ace58ee17ceb8ceb9973e95b86c08f4dffd0af93a4d9bce7b70117ac3c825
MD5 7a82929554e184137332387038897f94
BLAKE2b-256 81bb76d7488830a50349b48ddafd43e3a233b0f3dd82c3dc51ebd7375c3a2565

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

5.2.0

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page