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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.0.4-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.4-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.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.0.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b68eacad6cf323fa0b8400d107778ef526a9f3621c2d1615b01c0b14182fc4e7
MD5 c0691bd789578dd51f3a15b4b5623572
BLAKE2b-256 b1339e0633b754aa2f2f9527ec09c4ee0b723de86d416f1be3bb6c5be3057c2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fb77e16af0b6196a2acb07235db0bdc27182ded5023734d36fa67da86cc19b5e
MD5 1e9f08b89bad0c75541b9a2b368a2ffd
BLAKE2b-256 a7899999f109505f3c6e8a7d96f81e9362cd643c5502973ead8b892452e1fc6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c72eb03d492e49fe78ea93c4ff91bff8125c1eef498f27f8b6f573632538c5ea
MD5 59e71507c4310e6c4ff2957802242126
BLAKE2b-256 ef36947708768eee5d35306fa41458f3964819fa6c989e0612000ba0d1055bc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 930f5a019827287e29eb7354192336b9627c1934f87773565ac31cb806c02c6c
MD5 5ee04a18e4c52d102e0ad6ff3028e5cf
BLAKE2b-256 0e2e64d5f28a4671f2457f917a36c2ec8d761ce1eeae3acfa6da49d59dc6343a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0aebc9bbfba1b1044d92e8639049e2273fa9fc8c82bb286164edfe6e15b95c0f
MD5 3f59fdcc673e0a2b32d918fa8bbe5bf8
BLAKE2b-256 f01bc42360b5cc4692e68d20bb66aa366b6d577bc517e4da8a0db9c9259f5c50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b88bedd1268a1783757a18e3c63f6077ec93ff3fd52f1888dee511cdb809eebd
MD5 26f78e7d0084271dd44bb59dd1ea0ad9
BLAKE2b-256 b51f0ef516e66e465a6852a5d7c5d4cb013f0f8f9d370c61987059c795b55773

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a5685a449d5197115d80b940f8abd2993df6bd1658caade1c66b0a0a3760ec4c
MD5 422466e588ec1544cd3135311e45ffaf
BLAKE2b-256 c9df69f8f2b3ee6e64c7185c788ef8686748b86c6f8f22408cef70168d420cbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 97f893f27115f3bf3dac39317b0fa186b6ee49556e3caac326a74e950e00df04
MD5 93ddcc00a152ea4091c689d9caef53a6
BLAKE2b-256 66bff7007cbe3958c308096d050d347f74a065ba84118aa3fb819c555d613fdb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.4-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 cf7ce84895d7a228d9b36f8d3eda26ae9107878def157edade0da4e7ed9b8410
MD5 fa331647e7ecfb6f45880d12833d23d9
BLAKE2b-256 29b7bdf2be5a9e53a6cef2a117ecf1c9bfa8b00e020cd98bc8be365a6e53408b

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