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.

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.7-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.7-cp311-cp311-macosx_26_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

File details

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

File metadata

  • Download URL: pymiesim-5.1.7-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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ff65c28f8bbf4e8429fd994ed843c724048455e7c87b629f33521358a564d1e9
MD5 43cba7e66bf52e7e3eacdc1ec77abcc6
BLAKE2b-256 0f8c1dc033fdbf2404a4e6e1fa831661abe91cea178bea84ce1909227a81d3d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc1cc722a23b4fb03f204c81a807dcddc905b11d9147a22629ee3707628b50dd
MD5 437c9529be40b2788059a0a2ed85a730
BLAKE2b-256 32415174229cf2fecb51f8f3f64eaf15970cffdb4c5804211888a8e38e7d28b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 673570a53892ed2b1d07b4f06816aa8453e6f8f4e390f82867cedd23ae948f97
MD5 91137a8c5d669ede9ab83ab923d0003c
BLAKE2b-256 5e9e4b5e0ddf9261f914b00783eddc0589aaa03c036c9529a33e0ef24839e931

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.7-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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cf36cda0be06b01fcd14d0891bade90416ba9aafe664f798847de16d5064f5c3
MD5 407fe12f3483599a2b6b9208580c4bef
BLAKE2b-256 41f064d0ac51c2f8a6fbc348a28b51a35ef9059bef1263bce6ef4ce7a5eefd76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50d3379f7ea69776929cf2759fa3d4b876b34cfd95e56a5975d139fa7a52edad
MD5 cc3434fef4c186fcbae03556355aab8f
BLAKE2b-256 83acc347bf61ae18631b31d0c9f5162d6aafa41afc95fe37797b9cafb0acb2c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 feb9b0c470318e2149059fe18e421e7fe424def0268d2d8620ebbbda90e6276a
MD5 4a6f7a3babe5fd9e47f3029dc117b932
BLAKE2b-256 efabac6d9805aa5807d89d4dddee90d495cb7003ae9fccd6938179880d6726a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.7-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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 723b386b6f9066b74687aa1df37c6d23bd64afa2055acd59d225e0ddf8738442
MD5 1e8b5bd953daecd3713566c52790f0f2
BLAKE2b-256 83cd6eeafc7fc96ab7c339febf908eef7ec799c24b67f6b4e86fac8574004911

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8138b126d9a55f008c604f861bc746425c6c72a0fcb7a2417215fa3681cb679
MD5 385481cc0b2ff63b38b5bf3937631a81
BLAKE2b-256 d6a22908ebd58b2303ad3416cd7c469003244de943aaf06c85fee3b454bf3735

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.7-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 140f56217fbdd4d37e324163216d66376ee41a8529affa5500164295f89629a6
MD5 0ba442318b907df556dcf5954e8e98c4
BLAKE2b-256 2c4d7236d77285a16825668de762154f90fefa03241f6b171cfc5df4196aa1bf

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