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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

File metadata

  • Download URL: pymiesim-5.0.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 10.4 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.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e968fcc32b488c58468cbc70db8d0408272795441a0cf37f77fb4d5d72384e62
MD5 b82c36da5a8c20d5ae2342e04c58ea4c
BLAKE2b-256 b5d234eafd0c620140e0c7faeae06de96b2a2b16ade927b315ae7721126aa61b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ac1127ea8615505cb43e51523005c5054d622cfb37c33131975409cf381d20d3
MD5 a29aefac8f998abef67542edc8b01d9d
BLAKE2b-256 653fff83080005dd6a91513d13bfaa0c68af9aef8b235d09532a7d1a6b5c1a93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ee316bdc90e1c6901e167c5652dcc470fd7ef88b0f545ed85aae220fc860edf9
MD5 9daca387a0e26edfca3bb3862438bcd8
BLAKE2b-256 f5c26dc76d1cfbaebf0b38db08064810e624e7ac2bbc82fb40bcb71362fe6dd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 10.3 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.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 be68d57daae3ec298c6278b7895d931305a65a434efd96dbdf85b513d9e30774
MD5 3bfa57dffd0634630d0a8701e5bd9174
BLAKE2b-256 a3178291c880d791d900b16853ac20c2fa09369ac490f6c64cdcadb5c90e6211

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 96a910edc17e8c63c8a934f5547bea667be7f5ffb9187b70f2719ece8b4551ee
MD5 d8218b5ce2a9c589cb49afc5f6c0c537
BLAKE2b-256 24033f77940d168e9dce5ee2de90fc4b6c0d4490cb097b30183058bdd16d4abd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5416072d761522b15e2c7373eb61879a3de71566fafcc4c02ea2662298137649
MD5 3ee1c116451b9a97a3698a222498f4ba
BLAKE2b-256 1939a9b03b226eb753c00cf7c96bcd7545bb7360a06e28dff0ec2a78376eb407

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 10.3 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.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f0bfe1883eb1976d43cce2c591adb79330840ccc5b26325b124b9f43715933e
MD5 d01a4e463965526c8fbacaeaaec56c93
BLAKE2b-256 5d3764fceb5531966ffb4fb555aee7c921c97b4ee180dd001912ae7d4e655790

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e90b68520e5acf59234a72f56c37e340c8357cebf804be26670a3d2086b96337
MD5 bdb90c0b3522acd9327d001c8e06a338
BLAKE2b-256 1dbb4cce983730c9a7c241d48003e70b84aba7a3b7cc69f3052463b7818ee5a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 69b690eceb21e03b19aaac43f785a1ba28eb604957bad2c0389e7567139f0723
MD5 5d4fc94dcc8801e55cdf1f7ab2d47b06
BLAKE2b-256 319a35e13a450cab338adbfe2610ae5ee597f524240d81a5074e67e80fffee2f

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