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.

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.0.0rc0-cp313-cp313-win_amd64.whl (10.3 MB view details)

Uploaded CPython 3.13Windows x86-64

pymiesim-5.0.0rc0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pymiesim-5.0.0rc0-cp313-cp313-macosx_15_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pymiesim-5.0.0rc0-cp312-cp312-win_amd64.whl (10.3 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-5.0.0rc0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pymiesim-5.0.0rc0-cp312-cp312-macosx_15_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pymiesim-5.0.0rc0-cp311-cp311-win_amd64.whl (10.3 MB view details)

Uploaded CPython 3.11Windows x86-64

pymiesim-5.0.0rc0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pymiesim-5.0.0rc0-cp311-cp311-macosx_15_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file pymiesim-5.0.0rc0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6e4ec7850870de183613aaf3293f3a28d4914f1fc166918c2b92958b1b7cf069
MD5 999236b3ee0aad8a4e13d3620dca0063
BLAKE2b-256 98af308ad371e237ed524bdd51c304a0b5284b9911e63303931335556dcceb5a

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9afd372ef0ddc75a067141241144714efb99017a2fd6f317cbaa32604580e799
MD5 9150b73c9681a4f5c773944690dab020
BLAKE2b-256 aec3684c5225ffdd8fcf7bcd4a99327e99533a0c059f10ffe89d46e56272f4fe

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6e5325d0770cf410466bf64174fb40a9faa16025342e1967a22abe4d27887ecc
MD5 ae953526e61fe7b2f4ceef7f361b9be5
BLAKE2b-256 246c2fdad3639883a9ea6621671a0d3b27e6d826a1f038003ff9beb55c2161ad

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 22da1664988a3dfbc787bbd765022daaa9cca6cc5a725cd967867b89ab62f9b8
MD5 529ab7ad96c4293b6b551f52b65a5fab
BLAKE2b-256 093f6378a3963d2343ed85c3225398430fbf8663e0311728bed232888c13d9b7

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 70e54f52897885cc9d3ad5a1124c83e05f02f4d55d9c909bf1e5b00424b5ff98
MD5 db53ea11cc5a0d16884d97d82ecf0ac5
BLAKE2b-256 5511fc42a4602f6f3c88e4b7c24f8b47033fe98fef3123ec4f15b0fabde85836

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 77b5bb508a7e8817fb6dc475d4b7dd3deff188d1df1c73a81c5d3686f1c7926f
MD5 cd0ec0267ef7406c7176f7cb4eddc866
BLAKE2b-256 6c243b13c6927508331af4a140e7a802901a1ba3379ad2f91a414ac6caa1d9fc

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 587d847a7e6e95503dc00447b5e8191c88e28f2ef533fd661c5d81fa8f072c76
MD5 341f9965ad2a504c6e674fd417ed47fa
BLAKE2b-256 782862b7afe327176b64cb14f516a28b725d215f448ced4d41bb99040f2663db

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e7f42483ad33d99a040ec471c39e18787e9693b2a609b39f90e957fab391a3ef
MD5 2797bdd76aa0a4b03e8b30385eca65fe
BLAKE2b-256 e2c45045bb5ac677b21dd18729aa5fd0001c8f50dc79fa578aff3caad84b07d7

See more details on using hashes here.

File details

Details for the file pymiesim-5.0.0rc0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.0.0rc0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ca464ad8ad521286537c0af09aa305c25b701cd22d81aa09964a4160407f14db
MD5 406ec73239fc95de017786e525fc376e
BLAKE2b-256 9db6fe82b4e6dff61a35e46d3cdf84077c7ca750881d56b4c5f1a0dd2c85a846

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