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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.5-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.5-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.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.5-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.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 236001ea8544c4f36bb4d45bd609136063ae4dc44b4eb23069cfaaa228c2f2fb
MD5 5078d10921dfb873a438a3d055563cbb
BLAKE2b-256 eeb7face60254b7b3af619893583a4f98a1986e6a1ebeeb4caa4449175c97871

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3aee77582b9d1cee565e109c88c4399b7ca87c6c5dbaf05362dd164298ce78b8
MD5 6d9c72f8d426a315292ae44357264d72
BLAKE2b-256 2c2690533a539d1e8461bd6ce666e7b54dd6f18a504fdd6275322db6d6c3237b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 bead82fa79665c248e0d3b6bb96bbbf8cfbd0a1e58ac8780ce7a124d47f96b69
MD5 ef352e0c98409c96d8a045228768b5a6
BLAKE2b-256 29f423f404be2dede2d2b9d47572cfa9ee9d2b1d625297505bf5bc5bec7d8643

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.5-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.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1b124fd82e5929b3b5bb95044c6784e26d81e450bdc2e490edb2bcc4dc21b55f
MD5 265a8c1280273de64513e922f14cb554
BLAKE2b-256 234ddd9236bedc424dba8cb06ac6ce71d23a966a76504f26c8cc7359d8a5e089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25cfc5e408ce608d8f95fb8d303cd5ba15f155b10671f2d03cdf10b80570386c
MD5 6a1052a13c5491ec3a93d52ca999057c
BLAKE2b-256 b892a50e6bedce270ace1e13e28942ef1dbd308e71dd48ad9538b0e3e8dce602

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 9fd757c81c47f03d2b03140132ca20d0e78ece40082c90793d4f89ec49e5b146
MD5 fd0765af6267a5043b271ed3ce7ac89a
BLAKE2b-256 83731e644a71a53a7a41a6d28220e5e78e6b4521fc6de8bdcf4267b70ccd0278

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.5-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.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6ef871c874ab41f5093ee58ccd0bbf0be7efe93b4eca7d42b1edd884c389aa67
MD5 6e41bf880ae0e4f4ae7ad382d610b58f
BLAKE2b-256 18d2fad87885b2cee4a08ef8d3cf27f7d98994943086270cc197e60bf82604e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3f2a5b55aa2dcb9d7e2c557bc64b763a6363e0a573e0559459b9f3f901217653
MD5 680924ccdf49812cff5ec75720dc9428
BLAKE2b-256 49330de71ec1cba46796f9326b7bf01e466d050e800b1a4352c855bb12b98a96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.5-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 fa0f5416fccd826a1dd5d33e02d94341be9d37c1fe0156698edd7964e2b947fd
MD5 7531e1f1a0988060a1bed7d3ce9f7f3d
BLAKE2b-256 d467b31108ddad0a52e7979b86e79d3eec43202632007389f8ac0159cfa4c104

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