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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.11-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.11-cp313-cp313-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.11-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.11-cp312-cp312-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.11-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.11-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.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.11-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.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b906321eb880e9c1a22358cf5ef7386374124e6a2ec261db77d52e40061c5646
MD5 14fafa0d350cf3574fcb9003dd373c43
BLAKE2b-256 b43fba07ea51d5ffb23b52ac9128ca30bb8949b171614d8f2d9ed11c2514ee48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b548531f5bc60ee278bbe840e35331987b3febba72d5824b1b0b80ee88a3508a
MD5 81bd792ac0df0226610527b22ef0ef81
BLAKE2b-256 b3256f7677a5915b8622184099f03189bd564629adf4a98835b72fa53732d3a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 231d213dcec275b4606549f164e528cd1218f534197d9e4ab39542b3e2d75a2c
MD5 d9e9f758df81172f00058a8787440639
BLAKE2b-256 eaa23f31441acd5d346b1cc283e808de800367cf6202dd53208f75c7e8b2574a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.11-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.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0856be021c515cc780fe911164444b432ac6beb99ec07925e6b7cc5fec47bb90
MD5 f6059cfc2eb0647efe81b2c448b455ec
BLAKE2b-256 b49d98b97b43692ebfbed6518e378dab484edf957b489800e39d7c5c76759f20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b2c8f2fc1b7860111a74a39d4e6dfe01b9c32f46e3bb016ecacb2490f5f02d31
MD5 3fa6c0c472a89ce3c5afad83ea4a6f55
BLAKE2b-256 d4834d1c5802389066ad572b5efb5338273c93fc9c3997a49166c7141532ea75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 f1682fb02e646850cedf737682d9ad19ec1c71af27afe8324c31c3404761a059
MD5 0b0062275214e98717a5d003f5c4875b
BLAKE2b-256 fb275342b65c3cad0a38eb08a3fd11c2528f4025ca65e3719a82119e46c369a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.11-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.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7deb6b6b439a9db4cc31f7577f7e7ad958ffc94b6a925ce0accb04be6da79dfd
MD5 cfbc4309c12bc92204c02aa9bf9e4012
BLAKE2b-256 a8c30f3de9ef3a6f879c51c459a1df5182f5bdf530636207a4b9d971215153cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0e1ae88b8c017e948fc954bad9804021b610d5195598b24acc8a54da49e74a4
MD5 15d6c274f958db6211b416da9bf4c69e
BLAKE2b-256 221dafa1f7f9051f85d5aeb464da0229f520794e0483464392a4ebdf42115369

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.11-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 0883ca6a0a8a9beea706c891cbd3baa7dfb8bfa4c5793303e68343d202bede48
MD5 efdc37dc14ba946d6a99fc3b748940f4
BLAKE2b-256 be562f1e8e026776fb99d36b220d69b9faded5800172a489af949e7d19b3a896

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