Skip to main content

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.

Try the live web GUI: PyMieSim Parameter Sweep Lab.

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.

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

Uploaded CPython 3.13Windows x86-64

pymiesim-5.1.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.1.15-cp313-cp313-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

pymiesim-5.1.15-cp312-cp312-win_amd64.whl (11.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-5.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.1.15-cp312-cp312-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymiesim-5.1.15-cp311-cp311-macosx_26_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

File details

Details for the file pymiesim-5.1.15-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.1.15-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 11.8 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.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 02ee70011c1713c0fd24ce0275ff13130eb788975f7e29b3f3b95d057cb03c69
MD5 14a07cc3aa629027480ec6c3107aec2a
BLAKE2b-256 02366268e29bb49cf9102bafe446d219b461482f8a4fd4c6f135148dd31d20cb

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ec03e2491bad5ec20d4cc374e503603349180dd0e632212d1a6cf75f06fb647e
MD5 31c7989e9d4a2c3e62277a248c0d3b49
BLAKE2b-256 1071b582de003a528c8b7d6b67d04c028c568677700e9432f29f778926cb36ee

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp313-cp313-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 e6f4c9e5d7d7991c7d159ab25aa088ace6ed8f0c92ddb89f68d8b97f090347b5
MD5 09a1e60a5f919180cda5dc81cc0bb0ac
BLAKE2b-256 ed0bb64f6d8bebaa1d8c1f678ac1e4b49d4aec876a9abb97e72636c978ef3a62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.15-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 11.8 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.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 89020efe35b8a30def883f49f92f246c9063a67d2636f3500c3d303e88bdafdb
MD5 71265e5742807f33b8ed1ab7a51bc88b
BLAKE2b-256 03d0c52a75b4c3c4543f16edf5b6b06d9ef0bcb07f8df9eeb10c0236aa18d542

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 89a2e3f0e5952535037f7195e7c68b047c42ce6123e8ebc9f4dc1954ab1aac7d
MD5 6d452161be432a321069dd3e174e543f
BLAKE2b-256 436df660a4c24ee51101ea6ae4589b3a89242bab988beb780cacb7a8e6bd341d

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 0ad2bcbac15eb4dea84b55635938380ecf51007fe2969f292dd99189e43cc2e0
MD5 717a75d210f2fea9fa909403d8b903df
BLAKE2b-256 fd08d8d4a15bf8a01bcf07cba4ea1eeb3792aa39d56c346b2add7bc0843d84ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.1.15-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.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 21dc8d7e01a2598a437e82c1d28638e768a585efa2a8b60b1bd1447462e5aa1a
MD5 e9479fcfc08296dc3d7ab31679695dd2
BLAKE2b-256 b106f5cbeae778b97f3f0ec77720a1e8b5a469fae3ccf3f6692398f71099fc8d

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c321cbbc05fb13718adc3430dabc3d29e9b3c0b2f080c79de34966e78d54b58
MD5 a2f497a55942e8fa30ceae61d5eda8bb
BLAKE2b-256 98935ccceb31f585539b2eb3a470cf062014cb199ecc67bf2433764a22e51b94

See more details on using hashes here.

File details

Details for the file pymiesim-5.1.15-cp311-cp311-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pymiesim-5.1.15-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 0e4ad43dbfecb6fe1e8dd7c90b4209ac6ffa111e75d18258ae817f01db8828da
MD5 89f084a61a4ad9a50a9422c9ac221c27
BLAKE2b-256 eb3b474319164c68793db2d1c5b016cda5d1025edfe57d9693bb0735785721d3

See more details on using hashes here.

Release history Release notifications | RSS feed

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