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.1

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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.1-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.1-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.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 af6d643fd195b10b18b998b14098b8eda02a91c40608efb5f9478f5305636a8e
MD5 799338d8b0c7cb5e3450605d9aa8d9b3
BLAKE2b-256 40ed94ced9d26b76963949e9307ee423d7c0e82c06577c012fa603a11db57dca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 46abb64fc46235018f417c55c9a8f6d399c3d0bce05bf66fa8a6be06da2ff451
MD5 659c0064c9e793c60e6731601d273a4c
BLAKE2b-256 28a15990c237899e3eb999b97a833fe8ce9e327fdfa9a8470b23101f3a409f20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 bdd53aa955e431f81e2de09a06922b2e41e47b693d6e923db8d210e9fdc28a5f
MD5 3fc95393af5c1d5aaff68400b06dc3af
BLAKE2b-256 c753a2b8737bb5f19443f9f0484ca482b74c65fb2d4a57b383eff12bb2645304

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 116e6b92341a55db774120e2c1566ca9cde5216e3c47aa791facc9a8ff88f51f
MD5 c5257b0ace473f36a79cc1faa03898df
BLAKE2b-256 2f8e6aed2d81f5bb1f89686b3a32ce82cf74d7c8798dce68e137c685b12547a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 59e9b5bec8e79dbbd5f51e789d8ac190b7d114c34a952b5d08db3fbfd131e1f3
MD5 0912358e3f8f2f567d40f2778431abd7
BLAKE2b-256 c9c05e0ad8f956d71b9286ef8482910bac39c4b9ff942ff9648edd8c62f63fc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 62723b0085ac51280ccacf61044e19d816a3cea7cc9b36e92e21c665734a75cf
MD5 c5423e42e992997e0a87314205ff6460
BLAKE2b-256 c01c15ca0f137b29d41f6b46fb261b062d5721bff1ed7033351afc53877d3f60

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bd04f353ccc930a7ca94e10ef7fb32118c44cf7d93fc2db796931c17ba44eb76
MD5 22d2fcced34f15794b24c5097db9693d
BLAKE2b-256 607ee9f620993aa9da81112e4650d6ad03b6631cb806d2ff831e8764c13d79e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8426a195f2027cfb6a65cb4ce0d15ae2cf024924003cc3e200a75ba0cc63f7fa
MD5 ec43fb00e764f09f7203aef4c563020f
BLAKE2b-256 6fcf97bf8c066fdf82321edfe6d0e36c7071f22e8fdb9ee6abace8ea8fceeffe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.1-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 03c7c9d0e6f29fd25f8e1b991c626275b16922f772d6afda7c321b51316d6a30
MD5 0164d9bd5c5ff33c86a94ba79bcec357
BLAKE2b-256 2fea8c8c818486e821777b3ad7730d5a8f2fe6f5dbbbf681f3a16cbae992a737

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