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.

import numpy as np
from TypedUnit import ureg

from PyMieSim.experiment.scatterer import Sphere
from PyMieSim.experiment.source import Gaussian
from PyMieSim.experiment import Setup

source = Gaussian(
    wavelength=np.linspace(400, 1000, 500) * ureg.nanometer,
    polarization=0 * ureg.degree,
    optical_power=1e-3 * ureg.watt,
    NA=0.2 * ureg.AU,
)

scatterer = Sphere(
    diameter=[200, 300] * ureg.nanometer,
    property=[4] * ureg.RIU,
    medium_property=1 * ureg.RIU,
    source=source,
)

experiment = Setup(scatterer=scatterer, source=source)
df = experiment.get("Qsca")
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-4.0.2-cp313-cp313-win_amd64.whl (9.0 MB view details)

Uploaded CPython 3.13Windows x86-64

pymiesim-4.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pymiesim-4.0.2-cp313-cp313-macosx_15_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pymiesim-4.0.2-cp312-cp312-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pymiesim-4.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pymiesim-4.0.2-cp312-cp312-macosx_15_0_arm64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pymiesim-4.0.2-cp311-cp311-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11Windows x86-64

pymiesim-4.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pymiesim-4.0.2-cp311-cp311-macosx_15_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: pymiesim-4.0.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 9.0 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-4.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 732eaeb4ecc2cdca007d0995830e30883068385341aebaaf335aa7b3a1ccdc8b
MD5 0541caac54da579e60878ff5aac840bf
BLAKE2b-256 57450c6b649d6b4f896ff635dc232da2587b2cc7eb726342fa7f29ee5d951139

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 249cf9d778c777f8f36b145bb899f39095ab382b9c23d46509f3b8aada498f7d
MD5 835f8400462ce5deddfcb32cf8399990
BLAKE2b-256 0afeea044b11a2cfed2a32e742f3a466f8e9e474d065c23d2884b5c2d9e0f737

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d0c46cba03dce65966a2612277f517c50bbc004fbcd721f73bb927c17755542c
MD5 301b308c9dc9b0d16bb9e648650bc604
BLAKE2b-256 d351f5c8bb37a70ff36d2ebc81a088154e96179e14c76dd787c6bfb70dd957af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-4.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.2 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-4.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fbbfecd29988b34e933d815be555110f51b0fd0f90e1a14c8685476b09599645
MD5 ebfd4ee923fd8565ec1f65f9ff197a87
BLAKE2b-256 e66bd752d2f59e5820c9ff0a4b879ee6bb2cb6792324ab53bdbbd4b9e44d68f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7dbc0c450afa7bc89b8ab11d6a32cba06f462126cf54729a949ff5c611a19402
MD5 fb6b11f574cabfc5daf4804840385d75
BLAKE2b-256 e806928e897f0da4c8cd6545f28db9b154c047a60ea7d65e8038c60ac8e7274c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 016d455bd45a0516720f778cd6da19be3616f55926d06deef87e404da5162fc8
MD5 5da2918491fee60e80ddcdffcfb7b7d5
BLAKE2b-256 9a1d8b428af2b2ae65ca02c10e23e15a1dd0a1e704ef604386040a4b42bc0915

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-4.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.5 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-4.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6da0eb01732eefe8480ee7b7156b13ac7e77ca42ee25ebac39efeb1f056bd5a4
MD5 98595d33405e6cf125e69c26286c4d01
BLAKE2b-256 05c2e0e6e797489282a5d6b00492c5031caab5f6ebdbdaeac09d847ee445e518

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 88e1ec12073d4bcb6d173d3f1c921a3d8dd0f298ab3725580f8b112c391125b6
MD5 8bb6f39f1cfcda80d8dd339a616209d0
BLAKE2b-256 188426e11a3af8e7cfd219036743d638994cda015de19d8bc5e56bd9600aa113

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-4.0.2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 07e3fe732a23d1cd6babb08c476813a59d366a9fb4ed061869ce92068f2c6cfe
MD5 584ebba758bdf5abf32d7a49f889681d
BLAKE2b-256 db0b89083db1673e060958b15204511b33cbcd3a1ca43dde579128a741cd742f

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