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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.9-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.9-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.9-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.9-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.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3cd6bf0eacf7b36311d4ff8c72821dc69a16d490e7c8f79439c20d08cf0f853e
MD5 883e50b4a27b1ba118e816bbaa1ddafa
BLAKE2b-256 522a2b3d8145aea84a7a8fa44e2f36e53c564c974580e49ea096c6d2fe5e722e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 63241df4667e4eb517b038f337f9d24a4366c745f312e21d628508a1fd75cb32
MD5 deed8505f86ad872656c235c80cbe714
BLAKE2b-256 e63637602cf55ba18c1d887b9c8e13d8231ffbb6230b09921152970cbd5aee0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 619e1f490c72984a69ce73dbb2b4abff882619e5f75a3ee977fae5dbafe35b7c
MD5 4529456a5fef903100295dffbaa8a88d
BLAKE2b-256 cf73f6d5ff6697c588fa3a0838f357524d890188866d3c465d4834c871a24b3a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.9-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.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 42baf79cfcc5072cd0fada925d032c53a82f6e0cc1f5dcf0dbb95d7a260117f6
MD5 1d05afd08ec7554c080a94276fda6874
BLAKE2b-256 a672a2e8881043213b3f515c39a32b19dbee9df3d21a51c024168688e2a246e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1c1ef6bea72962ff51b8ed2b835836702a1fe75f7274cc9db1c55ce3ff791ec
MD5 fcf7d454b4fa9ef2b5da0933fba95309
BLAKE2b-256 3859b0d5723b0126b4d439c0eb73c5c80bfbecdb686ce8acfb35744804b7d7cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 3b9cf70929af1550ca2d39fe451c6e0955df57b0c14921f8339e4fc0af669dbf
MD5 f7bcfa73dfde3770489c33436e3cd40e
BLAKE2b-256 75b82b62057679bb6df9d452e63718951f13920ff31fd1a052a2763b2068f09c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.9-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.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2c9dfaf9eab53378407984ffe960fd4c73fdd2c9096627aca946e8ae6feacc58
MD5 c4fd6e27c4f2074cc47b1d0c303e4648
BLAKE2b-256 19e9b6a84008b9fd90e3b2a4d7aa77635d821cb4a590d602aedff81115464b67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 146f5e57c393c43027a6476909e408539d75a1fb58c63b1cce27dcd54dbd702f
MD5 245f97951e140b3b9e17059fb8316e3a
BLAKE2b-256 259b093674e4037d75ff4b00e037b4dd613f02dd836a81f9f39bce96d0cd2506

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.9-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 9d75ff40aceea28a5c7bf4240e5dcf288a9437369beb7518daef4a7d80422742
MD5 fe1dd469accebd09e200b74750e70826
BLAKE2b-256 549dcb5cd6dbbde63b6f272bc92d1a07384aaa2475764b712d5ff83e430d4f34

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