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

This version

5.0.3

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

pymiesim-5.0.3-cp312-cp312-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pymiesim-5.0.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.0.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9f67b46a6e0043017217a80c38830ac0942e38e210b60fe9ba2145c98edf419b
MD5 8d9a61e5f92523a40c1b58bbaf79204a
BLAKE2b-256 d8593d97c9bc75fd658007877b406bb931f9ba5568fd92fb370e7d031156238a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 800d7399a99567734113533886ef7871a1ddf4e15a607fd73b6131d5604cd9d9
MD5 3b347e1f0ce2effd0dc331c93458ae06
BLAKE2b-256 2e27015096237c4af567490196e8f15a59763daa59aa53c11f9f80c121d26d5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d648ebe05e808fcc13f1bc944e11acd9ef45e0e46f3467b6dea99ef4be63beab
MD5 5346dbf10105547410ecd392d2e0be73
BLAKE2b-256 0fa1276c36ff084221cf9c5300a078eb269f36c32a879ed9232411884f33cd57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 10.4 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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d1020eac459e16c0c8c58fb04da9a92df64605bad7913db52e41c565801a9f8a
MD5 a6920e9e2c261dca00e581fcedda049c
BLAKE2b-256 04a8bc646e09e04a1d4a4495e76eb917eb395d0eee913f14cd4baec9fcb32f9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6b77100e09ed2623cb6a5b4bc7a0b1e0b44eaca0a8062b72cd04623c88a00b45
MD5 b6337aa7b5e6e4c2b88cfed53fc7cec1
BLAKE2b-256 876ff6f9b99142850010793238a88fbdee5bdc12efc74ccb829091630e426722

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 154eacc415729f546e49541eea4452c9392ee3b611780dae0602d448339262fd
MD5 e393dab2df3904072e92b99cafaaeb05
BLAKE2b-256 b0d449eccdd4818b45d0f6bd7543bff7b50d6924b4bb9b7bb97ed1a9c9f48e18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 323af26d681035bcdb85aea605bdb583de77adf4a3f7429cc5c26d5792aa7b2b
MD5 d35ad07289bd0bd201aeae06694a55c5
BLAKE2b-256 ad464461307033a4ae310ab69d6239a23af33f2134ec03e1f3af20536505a8ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9476d0db20baf77b5563e7cf9379ac3a19976b8dffa109756e58f3ee3761b55d
MD5 124ec39b3ef59cc627518b7bc237067e
BLAKE2b-256 a49f216c503a59f10794b25ba78c629e6f467e738d5dc9a04bcc247aff57ff5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 22c4b5d87df7ff2b03a73761a8daa41510056ddac87fcafe9032b1327ac970ec
MD5 3fa2e9843cab52d5cee7e5895d354cef
BLAKE2b-256 bb98a49d0f070f9aea66a6908c564d6b18c8bc64de7ab9964fff40a13f47bd23

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