Skip to main content

A package for light scattering (Mie) computation.

Project description

PyOptik logo

Meta

Python

Documentation Status

Scientific article

Testing

Unittest Status

Unittest coverage

Google Colab

PyPI

PyPI version

PyPI downloads

Anaconda

Anaconda version

Anaconda downloads

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.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")
Scattering efficiency of a 200 nm sphere with refractive index 4.0.

Experiment Dashboard

PyMieSim also ships with a Dash-based experiment dashboard for interactive set configuration, CSV export, and quick visual exploration of experiment outputs.

The dashboard is intended to feel like a small server-hosted application rather than a one-off demo. It uses a browser-based interface served from the local machine or from a remote host that you bind explicitly.

Launch it from the repository checkout or installed package with:

python -m PyMieSim --host 127.0.0.1 --port 8050

For a server deployment or LAN-accessible instance, bind to all interfaces and keep the browser closed:

python -m PyMieSim --host 0.0.0.0 --port 8050 --no-browser

Debug mode is off by default. Enable it only when you want verbose logs and Dash debug tooling:

python -m PyMieSim --debug

Example dashboard view placeholder:

Placeholder preview of the PyMieSim experiment dashboard.

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.

Project details


Release history Release notifications | RSS feed

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.1.12-cp313-cp313-win_amd64.whl (12.2 MB view details)

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

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

pymiesim-5.1.12-cp313-cp313-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

pymiesim-5.1.12-cp312-cp312-win_amd64.whl (12.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.9 MB view details)

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

pymiesim-5.1.12-cp312-cp312-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

pymiesim-5.1.12-cp311-cp311-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.8 MB view details)

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

pymiesim-5.1.12-cp311-cp311-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

File details

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

File metadata

  • Download URL: pymiesim-5.1.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 12.2 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.1.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 761aa8fcb99e57c25aad6948bbbd4d381125891ef62a30f84c6378208a481984
MD5 ff307c7314840aba308ed5ebd77a5f9c
BLAKE2b-256 744398b10c7d1a0d95990f87bbcba8b88f63a4aaa81821d3203088f0114c2f7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1fb1222fb23ed31534754ff85f6b91c57344187c27bb810aa6953b46a655fd51
MD5 f2bb1c7963e444be0816bc482ea158f8
BLAKE2b-256 e2196a6236f2c0644997c0ea2c1151acf7721143c20eccc2a3d697fbc8a49eaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 a77f7d88c24f6dcfc704c6965fcb85edea51dfc19fe6d557abe13951717e747f
MD5 fe0d94759428a2fd6c3ec19e3d4ee03b
BLAKE2b-256 eb8ae62314fa2b32f7aab23331cb338a791336b014869405ccb34ff5ad77af36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.12-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.2 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.1.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 44d69ced69066d73e84318cdf05076cd80175c9c978a4b6f8c66fb11f0ff855e
MD5 c119f92f1d21a53570492d69b0a8aec1
BLAKE2b-256 9505b6c20df3b1e1bbc085e13f208f8e8169e9fc0f34a5c83e68de8e5048c02e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ece92f5e3be9c02deef840afbc49626846d7af918740ce5f4d8191b4fcff93b
MD5 6ab72f5409d45d599d378d782d7064f3
BLAKE2b-256 68798a40574f4c08b58803446a7a388e739e4196f77805595d71a9498c99416c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 6163d9e88844b011d092ea449a610ca412cbe03dc5caff5964b7e1319099477b
MD5 c23b551e965df20177329a896570b9d5
BLAKE2b-256 55beb3e7d364a5a47f09374919ea83849f7ec27fb3f67ca66dc1d1c62aaa896b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.12-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.1 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.1.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7882e5b18b8b2931834d8380e5fc492a63dfac1edfe0856bc3592fc96abe6555
MD5 9d641c207e3bcea6f221462687561e62
BLAKE2b-256 f11c5f2b794b7d6e410a82ece146c6543f98d6ff6d20e92c9885c2f116d9b2cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c877ca12efdf6fe1230d3b7942f62ba4d430e3e6f9fe113d73b385ec4187eea
MD5 67c4d3c0717aedfcb8066e028957450f
BLAKE2b-256 c477c9edd65a317c111f837e160b895f9884aeebf6296b2beef1e8a200c23230

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.12-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 651ceed47c22c86b4d43d0cfd11fe0f9c4600fca39adb679becd4fed4afae8bc
MD5 73368ed92d69b423389d6d8c8280a709
BLAKE2b-256 332408de956a488d24870b5e8e8e0f7a2c45459f646087a6309b455eb409d8e5

See more details on using hashes here.

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