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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 26.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.4-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.4-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.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5918251e858b63476448e9c215677614cef085f45be284af4377cb3dd0544c92
MD5 649c51af64e730751d3f49adadd623c3
BLAKE2b-256 f240a9a2af1ffb16a2a776d3c193f065233d1bb6f1a0e9d561fe65c01bc1901d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b769e42dabce8fe07d13dc1b1a92ba711562d887757d6a95dfb2c785389cce1a
MD5 0c4201efa981c8e88fd409aee851a458
BLAKE2b-256 bfd994c279a0b1269274dc90b21070a7790686ff73140e539b723c0f645e39fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 404244eb8cf0b1bb2645fb5a4c311b8bb32b2a4e316b080f947da1a4a787866d
MD5 61af68ec05347981e3b6e60e1cef477b
BLAKE2b-256 29c2ea50d085760b6db76ee1c47ffd31e67091d849b92c7cf110960cac7f66d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 383db14e884cbf3df77df60655cc6605c718377c75a7e3033f0831dcbed92ae3
MD5 80e2275c4f771f6cc4e78a59501f3696
BLAKE2b-256 7ea0921eee00a69f0ce1325ea61f5e20d1e9b146a93518c83b868da5ba222d77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 58d083df997c956e80969da89cd4c15a7792c91925c603483e1fcf81df2e91e7
MD5 c806f9b9d6fcd502bd235fe5a357eb79
BLAKE2b-256 246a07b80c55913749a4fd36998fba13972debe6fc02f1b953f5c98abe7d4ede

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 2b2b4c943ed95f2783d2ba3ee35acf4e4de963f89fbd2d12b350a77d791b8502
MD5 bc62f1fee3d8973365e79d923549f111
BLAKE2b-256 a62d0ccafee5bc6971ac35bea6e2b7100b7fcbcaa3561a6eee5cb817e2f0688b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a04fb1e184aa577ff644c7657145ac0bcc1952f751e6c01025602d63b2365200
MD5 830a2e05f07ee2934cb6c0706afa574a
BLAKE2b-256 afa99390ffd2c6aa31418af0097c49ec751b1d430c59b7b5ce433dad1c42b095

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 63ff05a81d3570fd7eac96c621dba6185259b1305b57a0031c36633b3c3cdd8d
MD5 bed9d2c9da67db8de8417d614fe42fe5
BLAKE2b-256 de5161b38cb8aa36c8bc4686e43dfea06f9e09969f096b7bd8f069f8b02b427f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.4-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 b86a03e4d5769c8414359210b74266ef6b7cf4570634cd0a2aabeeaadcf0229c
MD5 e224dc282278070b02eae1818c92a795
BLAKE2b-256 27c3aad3b789500c8df13d2f1fd1e3d6302fd137ce2d57029de6ac5556e85b17

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