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.

Try the live web GUI: PyMieSim Parameter Sweep Lab.

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.13-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.13-cp311-cp311-macosx_26_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

File details

Details for the file pymiesim-5.1.13-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.13-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.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c5c6caf3a676694fe41ac503ca88cc7237d63b71c9ae2680d0153465b6011032
MD5 a23b7af803379ae99104d6d4ca57435f
BLAKE2b-256 cd1e5d6c1ee5cf7230ad5b6412ae42085b520cec2aeb48b763171980f4cc6c0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 693b050d7cd9ae5a41f0c5ed7fbd5428d0e988ec62e6f5b6acf49d4287d30d21
MD5 5dc9988b3cf27723e4cc318c874cd29a
BLAKE2b-256 39d3d41f3145282e197c46bb1f208dde7b6d037d1c95642256563c0cddb0b31e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 bc070b22911b18b749d330313d25c054df4cb12c174e84fd38ce0641e15be790
MD5 d16a23c0e9e8d06a3b7301a3df598dca
BLAKE2b-256 9625a5fc8a7f0cd2b52e787c74547e2b0e389a03bfb16623321db6868f4cffc2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.13-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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ec4307372375389fdb67cdbbf5912560a6466602f0116b9f309980336e572271
MD5 eb1918d83ff0a9953893fe538170dbc6
BLAKE2b-256 aa92a4fd0b883cf0db7aa9ff9c0d3efc5c83ecb92029b43cabbecb93b0b911b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c3f06c23e5b75f18f13981ef58043283d11739197be21fd0b3349ce70955ac83
MD5 a01e6f08338ab179181aa34a75b78d17
BLAKE2b-256 a19d0d4b8b5f26324affcf5772adb3b0cfab02efbbe3a3d9ba73d022a71e30e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 c9877f847ca91b11063e4617f10061de3f2275f83c7537642d4d5874a0827c60
MD5 df45aa741302530ee682e73f571baa5f
BLAKE2b-256 a7f7b4aa30adc8adbd01e34172017506c941823fdae0cb2faaa97560de733e6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.13-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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 94fb46daf616ab271e503b92ecf61d11ecf64ed2b6692a81b9842db4ce3eac20
MD5 1ab9aeb5c192a3b09aae35168938a338
BLAKE2b-256 0ddd96cd855becc86e44f720a2b36eed44696a44ce1e7289b704b25913ca7b71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5c1ab34761e54f95e843693edd3c1faaedc96eaba415dd187b3868859bc6b30f
MD5 4603aabf80ac9b92cace0b377e8cfee3
BLAKE2b-256 b8d469c93471e4abfc7cfdeceb6fcdf2a6e01c79bd0ad20efadfa11b3f242877

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.13-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 c3e90af6a308a63dc51fac86af80456bea867697383201a5010651423173658e
MD5 c22d5ffe32019d88223a559125df4b83
BLAKE2b-256 5700778c675dba9e22e4f8d17acccb65f58b78952c817cdaf8fb51b0c4704a8a

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