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

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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.2-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.2-cp313-cp313-macosx_15_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.2-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.2-cp312-cp312-macosx_15_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.2-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.2-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.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.2-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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bd29ae2c523fb8239fdd7e6b270b7059c6942ecbd16d3f14065bd6d07fe08890
MD5 f0bd0c6c26ba0aa198c3bf28877e639f
BLAKE2b-256 57caacdc0319d27048b8661dd5603294e5927f9e3c8e85e6606a67230b8c9770

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c0314cbc673f3a998a7a9d1b399d75d7b2304761b426142db00534b15b65638f
MD5 78d1635f444d42c38fe3eb6c6e331281
BLAKE2b-256 d54a56de341b44a95d7ad80e6eea15c0dac66a3c65d89e8df4b1bfbf7ffe2ab1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ed8d3095c90f7c5cb18a0156bd1a7dafd23f52aa521b51963c83fe6abffcb4c8
MD5 a45c1f3b290270bc72b9e4d0c1fc4593
BLAKE2b-256 ed750944981cd71c8d05ce865854b1e8f4be6d884f3c187e2c3d4c5dc1a794d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b6ef4f22e4cc0a3f7f477ed20a4f65331768df759edd9f7cd6158000e7f410ca
MD5 6597ff1faaff26a7ec4894cbdd242775
BLAKE2b-256 0d7adf17b80b88fc03e045de0df9e20eda7b6f6dcc5c01947eadf96095105236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a86a2ad98cf5817eebda4026df1dcb8d5385da1b35898604b02b262eb04a5a5f
MD5 af986fd2369fa9a590e4acf34e258e98
BLAKE2b-256 5a2de2942459d5616a58a8a1e911847c3f7a4cd0b7342be9808bdc25c4df9875

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 dc9ca07dd32364140b0f29c47b0d1fcf0c498c06927387bcbd0fe1285d417ed0
MD5 6dcf0760f96d92116725c5a47c4cd6d5
BLAKE2b-256 7b2abcae9bd96cdde796aa4b36f422db4390f55628cca46acbe37a008601ab02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42fa8b71631d7dea7723b2d27127e9e0140d91bf5e411a97244f48cc300e8ef6
MD5 e0541bf2d86b98d7374280d283b60ca4
BLAKE2b-256 5b5adfd31773fa396a340fe01553a93c4e5b0edba31c0bc1b501e8faa868a725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f5c1c45ea8938054fe0d9a0c00b87d92561758b9271c1fb4bc523795c82f5389
MD5 d5d9cef93195be081af01932dcad42b6
BLAKE2b-256 d7cd2d2574002db1e261fa26d9d2bd2a79d249365adfd47a84b5c70b3e312f2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.1.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 125ee20ebd612d62c2cef0dbbf9145cc9d8520fd8099b4b72c55088626eff12f
MD5 62fad50d1e374c8595c15393b1943074
BLAKE2b-256 0174edf057428a8bee05bfbf94fc05c2c94e6aa9c6691227606427b2a0147208

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