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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.10-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.10-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.10-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.10-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.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 87b476cb7d8036ee552a318670ddcd3c56735236c1c4a2ee00d18e23f01fb611
MD5 a059bf7c85347ba0585eeb3f965db04b
BLAKE2b-256 8b5dfc6d33ba6b1086b2d84581153e5aa01c2d5333415b287efd51120dbe2526

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7fee96466ae5583002f2e815b66ffd6d7e13366c675e0804bad6908b53c9952
MD5 0bc2657bf4a54b128b1d395a1daa9baf
BLAKE2b-256 2792718104dc67f217184b0bac0fa00ab9ce35cec62acdeeebb54736dc7f4c88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 dfd500c6aedf1b2751805a8a3803d10ad807e97dc64bda439849ad201409404f
MD5 d043a2e1a6e85bb3304c82152a9ca7d7
BLAKE2b-256 9266dd4a4620696c21938f951e27c2bcc3db39be1e1d470b7b769187f0d9b5d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.10-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.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d125041fdec0a9037364e1da62ef48abb6844c7a030c1284cc2b707303de1020
MD5 5d7d963837c96197ef30e16244505b1b
BLAKE2b-256 5453b362158de951e41676adc4065c985dafc45fce80ee539428262512bef289

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6321aaa777559a460cc79864e71907ee1f5c6cca339d94b6dd744bb36247794a
MD5 860e3e76d92d9e00c83e4abd4fa41fd1
BLAKE2b-256 533b17e6fef9d4d490e2c5befce0cdca19b4b6eabd07429ece35fd36cc1fdc7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 6f2c6a17022a6fbdfd258d30edb71572f52515b8852af2d7cbb9fb55a6dfa3be
MD5 c5e2d383fe0afd68a5467a5643524163
BLAKE2b-256 0f53a5f9f07a197777902a9768710d0d2f31d67fca15a42cd537d30bee3f61ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.10-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.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c5d69e0ba58405a3d0623209133b6d6aac39b3e6f6ab320fa6b5c995d6be3df1
MD5 866fed3040d6c2f739b096fb3a2875b7
BLAKE2b-256 2569559364eb5ab1ef2810288634ea753af3d8480aaef67a82b5a164b26d8ef4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 81b50a769b97b8f22819aa017dcb793cd7ac9990b4759d27661b42358ab1ac77
MD5 d28693e5e29f82f5526ac4642784a52b
BLAKE2b-256 3864282a632615abd0bbf83d9b3732e7643e46abef4b7ef80f4cedeba98cf690

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.10-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 99d17729b09cf78adc164a778f7523e213f4e8eb1c563b98c301fcba1a268c4b
MD5 6c262617a06f8ae1f9572200f925a6bb
BLAKE2b-256 5d304b693d541c32b1bbcd2059a3a8fda2ba37ecef277f876b0cd62c30d7d223

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