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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.8-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.8-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.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.8-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.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dae1bca02a81954e6ee0f8f1a4c83dd0c61c6b2ebba70562243aac60d1d01972
MD5 d9cec8b684d5000541d56f2354a10ed9
BLAKE2b-256 d223e15664d0f7ce5c2ec11040c09df06a89c3c4e7cc7d6d29ba98f85ef1fb3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7763e6992ad0ce4b233822a360febc009f9248a05aa06ca0b238a6e9d3cc2f9f
MD5 65324a4be6a13705d474a50c4bf8254d
BLAKE2b-256 f27643b1f1442480ffbd7c73b6d87f0819547a930f7a25a632e316188c71f2e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 6410eb14f98aea1dc33a370d1d13d4ccf3620f1e905049afb37ea6eea574ebd0
MD5 87fc021d9d3a933513e534f1c1bfeb06
BLAKE2b-256 4353ed53ad1b483243013825419f76eab3f1a30843e9fd6386fe2a31ee1f7bc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.8-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.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2d24e3c22fa03a06b13bbc67f54f05ea9165f5df1521b13d7a8dcfbf53c9bd48
MD5 53195fe2b4b832c8489b170c62ce51c2
BLAKE2b-256 3b7b508ed13c70bb05d102adff24ec05c91403cf2e24686b832238e53f0f98bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de418451085e319446c8bd5922c7aeae810369e03e9f9507e2b58b803199ab62
MD5 ae000edc3374b8d56e0da846a8c4c55a
BLAKE2b-256 773085e352cca9c39e5ada6fad275176c9dbb8be9b3cea0d149de82baa52b301

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 14339cc2787cc193585b223059362b29a6b3d680baf64bf1dbaf348d18f4ebfd
MD5 da4874937e7792595b0110e402162e8c
BLAKE2b-256 97cdf0f2d80c3aef1d8e7c356bbe31665718ef35483c9b5a7bfcf511a2419696

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.8-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.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 641ea7408d206a697c40c1968b99e8162172dde5a8bcb5dd83235387cb157fa2
MD5 26f99bdf1c20513f98a5656669092320
BLAKE2b-256 068377352787978f7648450c0744bf675d27fb7251e8390125a00217ba7b57f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a40e392233746512a333990e4119e8c13427ec2f88f78d2db5159c376da86295
MD5 68b65518e2f65ea64f7ad5a48d3edd6d
BLAKE2b-256 8b14035489c6dec5fa719d1e5877d6553a8f17bdfe60d4b082e8c2d5f3070c39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.8-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 db041b10691f821693e91944627ed2789a36d88913705d551c2b008ec96cf483
MD5 c91cacd80efa82c0cf5449c263907ea3
BLAKE2b-256 918bff79952f63e46613c256890916463da0a753d887b42a42e65a7c4f7a2f04

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