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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.8 MB view details)

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

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.8 MB view details)

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

pymiesim-5.1.3-cp312-cp312-macosx_26_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.3-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.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 eff6d9fcd38383b5c1967657d6cde99632a4d760600560bfd117c81a72ea8083
MD5 d500a006ae7d78fd4b075e81457ee386
BLAKE2b-256 9f2a1418aa29a28e28246292bef45de4a3cdefab1ea1cf0fda5cc0f27b4eae2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eedafa40ca1fd110e485e857243e5c304809b97748428030f960bfc613409ce7
MD5 a228d42ae2c7338be5562ed210e23977
BLAKE2b-256 4d76cd8b8a7e36ebc0689155bde3336d842f17a3dc615260a4d6336597126ea5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 0fddadd95558071e67872b5b4df75e649c2b58801190c4ba3bf120154c77c462
MD5 858786467f68d761356f7932abb91549
BLAKE2b-256 69628341e65043ee3a53711fdd4fe35bae60a9a65692bf830fc2c06c9347fdb1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 93be2715ff7ee14d610469c8b71d00581ec8f1a9a8f7dfcabfe468ecc9c66c9a
MD5 88cfca1ef86fcfc495db913d3f2c019d
BLAKE2b-256 9c26f6f6b804d4f9984cb24e8f8cb5bf332dd106d8cadfff97a6bf42f3afabe0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2433dea24d2706536361c2b3404d59b196ad7cc03f391882e25c0de45c0d7f67
MD5 d18d0b0ddd4d8b07272d795417a4abaf
BLAKE2b-256 4f32268291c44a4a1b072f7ee74eea57ed3794be5520196aa13fbea25f9c9441

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 ed284378790605667c08abf52ff2b09d9da128f8c479e445724a2ff3da4eddf3
MD5 cc198a3537052e683c139e1a483eec53
BLAKE2b-256 20c033dbfa10cc24544244f1afba97ed5245938d14769a03b1babb0bad67e7e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8cf50299d3e3fdc795301b1807e0ce45df1d75a79f34c41a49bdb99f1c4aa6ce
MD5 7c15e80682c6699aab81aab310eb5266
BLAKE2b-256 353f85a44a7153cb11b8613cdc979e0498d539a1b1bc942f72e2015ae8af2b52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f257f273fe8d04a12dc892a3e4b10aaef3883c2fe0c8c03b781eb37f82db25c8
MD5 d295850f1ae84336d0c8fd09ef006d97
BLAKE2b-256 7c428480b2daa9e578bc83c1e2d34c73add9ba205b0c538610a3fde72c5891f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.3-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 56084c39bec7f5e575724564fabffd09fb89757e8a2fd3e24b13ae38037f73f6
MD5 fad75fa7dac4d612db03c7cbce0eee9c
BLAKE2b-256 5f9211d4e9da3f91941cc830f38eabec7bd2716e2efc11cb9034e83cb5fea9d8

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