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.

Launch it from the repository checkout or installed package with:

python -m PyMieSim --host 127.0.0.1 --port 8050

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

This version

5.1.0

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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pymiesim-5.1.0-cp313-cp313-macosx_15_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pymiesim-5.1.0-cp312-cp312-win_amd64.whl (11.9 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pymiesim-5.1.0-cp312-cp312-macosx_15_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pymiesim-5.1.0-cp311-cp311-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pymiesim-5.1.0-cp311-cp311-macosx_15_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: pymiesim-5.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 11.9 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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d65768ea56400b6369a809d527d7b20c19351f1e6679b609e4c3ba8a0710702c
MD5 baf9e80990e1ccd0a143363d9d6a3c64
BLAKE2b-256 ccbbd856f5014b9d38bbc592c99ccf102e502186e113ceb6d01cf734aecfa4ae

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0e67694c15ee03dd3aa1910e12ea5db8d8ebcfe80194d4cf5fadd21757ff1ca2
MD5 0f1f82a3bb2d8a2694976b1b38bc8d52
BLAKE2b-256 64d2f289d3672c136635d562f695274a467cd5d319c3ce962131185829c045f9

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9e8d5b08dab980becd1fc617cb5812d0d5f069e161526604ee59ddfc5612e7a9
MD5 a41771150b25580180cd0e3a500cd501
BLAKE2b-256 12eeec1eb5b2bfcbe481e2d277094beb31031e6fdf22de170dff6e398a4a1c50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 11.9 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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 32a0a61a1b95fe3a7c99a68a52e456b3cb3510a6635af82e27cbecaec1e8a2b5
MD5 554b78603aa7f237c0b2fac9cf5ee50c
BLAKE2b-256 45496b4bccc7b09e0adaae7c115a20dc4f0c92ea2eee77c6925e09658f0963e0

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7282bddc7efcbd29fc56a1a9310d867b306c30645023ee93c5a0574233cfcb69
MD5 508791415bd8a93caaca6bd00d950dde
BLAKE2b-256 1a3747ede18e51eb839696fd4992ab05c593d2e2b2dde89ae7ad0b5d2d37b916

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3548bf29dfc61a1906bec373100dacb0685a6850b2d907b87ea73ee4e3a8cf39
MD5 ffc9b64d8e0836a0d462c24fa6d9e7b0
BLAKE2b-256 86dd54da60c80c6f6d35d98d6eb2b2f52ec9a66b016bb2cd2c7c72542bc8956b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 11.8 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 591194022de6bf4e583fbdbd84749b64f50ba155c029fa6238e2bc5003f028e6
MD5 05c5ccf9a7a1a0549b0d039e89f1ba06
BLAKE2b-256 fcecbae8d5e881e8c45bf558e194369561d0de0ce884e28fa5af54cf77209264

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2843fbf4871be59be6513ab588c14487748841f2414df499873198520c4975f7
MD5 2ffb54c6d1090b57708ef117115c4ae1
BLAKE2b-256 1282d484f265f359055ade27ea74963d9d724cf8f8a186d867370a38bccbb921

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6061490ca142a8d54d2d05bab186a560dfbe11868becd8a5e65899a6425ddc31
MD5 c9be6b1042d68e4ea6c82eec9b3b7af7
BLAKE2b-256 af0ddd82f415afd42bfa33bb741dd7eda4eea100f11e5b5c68f5b8ee330de215

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