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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.6-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.6-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.6-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.6-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.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3ade28684bffdc961dc89948de04580c9864bd1c9766e070fbd3cfb9cfe048ab
MD5 4cfdfdb901c1a5c94146d7325596dfc0
BLAKE2b-256 2e59b78c14fabead5fb8cf0bebcbe337c2a784af9387785f57a26a3a7e9f8183

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9a2200fde54c1f34ad3adad2636aca8a7bb8c68d434c2238db691820117fb0d
MD5 d73fa6e305c3a5da818e4090d8d5e36e
BLAKE2b-256 171adef715dbafbc119c9a9a36875de2bc95d286ca1fff97a87470e3aa26658d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 aaec099fc58257f0923d603674d29c9a71d1dc4315785e00ca1c7b4a556c5a3e
MD5 bdf423a22447f498e5d64c234d780a0a
BLAKE2b-256 93b856583553ca46804c24b118e4351bb5f61c068387e2b2418e5539ca8c2582

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.6-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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7929c0c1416f31578ab88c48c5846e57cce8a9e4f104086d5a471eecf495c932
MD5 fef7b508cd9c6ea603d983dc73eb3bd6
BLAKE2b-256 276262c5d2d4e1655846eb4feb0801398e165bde12717f6a962c7aec9b99004b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 24613a2b74c873ad88ec2698d07b51c2fcf8c502d76582cc6eedc5a95bce7345
MD5 fd420072080bf467e7c48d278656d57c
BLAKE2b-256 18d268a617e7c923e9701552e3f8d5a6f09aec8a7ac50747c1b10aeb995686a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 068627632cd06c5c1afe395c71ae24e94297919bea7be95474357004732daa60
MD5 f29caf86f631a06d35e6685ebde9ad3c
BLAKE2b-256 005b726190d3fbafcefd3eba5b99d1df6939b4798f60d86753c2b892d9a2c364

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.6-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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b4682fafd7d498b6639a306187190ed8c4fa254c6b5d9c12c6a6638519b9bcd
MD5 50e91d7798b916367de0210103183c4b
BLAKE2b-256 f6c7b78007fffe1006fb34ed982fd99f4cc8029088e22c421772d1d2735a5649

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f6c672dcb6badc4df30807e674a7c510fff362c3ecfca1da5646bff07b0329f6
MD5 eee4822c38da9e1c12c7a112f4695891
BLAKE2b-256 6c6e608cb035b12501ab15c5c3a9c55baabbb747a960f0f05a8550bb075bb75f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.6-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 c1447c17ca0187e9bf54156c6c0cf27d705cdacfdf1618463d7df75b20c6359f
MD5 6a5bf22504e67d4420d1990e3d20305d
BLAKE2b-256 dbf29df4fcdb52f065bdcec4b4ea356590f62e2d040f06fc1cec4b64f1062965

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