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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pymiesim-5.0.0-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.0-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.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pymiesim-5.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 10.3 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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 72bdb3d6cc257baafba08cada21c01ec90660a3ee007bd8177a2bcdfd1a82c05
MD5 455732779dc53c55ae4e4a6d6428aa9f
BLAKE2b-256 9eb98843a1d887fe115de36abef4c299e46e998139e7c45ddbbb59d6d4df1a83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 96bdc26eb7b8dde39e163c1874cfcf5cacdbe161dbc7a15d1591ffae67c10283
MD5 d69fe34e2cc0847f2370d0efbbc1a741
BLAKE2b-256 9582011581ef583130e65f4656e2d5b8f6f0f9b49ee5aea3ed869ca6048f0b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4079fc5eb9902bef5fc306d11454295cde09cc477fc09e21274b85d945adc1a7
MD5 34732140d68d4a1e1736e324e2c111e6
BLAKE2b-256 df23a4f980ca75bedf62e1c72445f6e384c08eaf0d42ba1c6de5f57902f0ddfe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.0-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.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 567ca7e56d2584aec95ce61e9252a4c02018cc7984bc03f3f80f93f5914f94c4
MD5 474bc1a7abca43aba672dedba4058352
BLAKE2b-256 5a066b788280bd69352c0c04825993cff42445cfe01057c9de90191325d5fb63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1b8e8ecb8e5ccaf674f03bfa10363c3fb7136a6ffbf53218b429bc6f5e86a84a
MD5 91f18290a1acc5795588eae1f7ac498e
BLAKE2b-256 00e98bb47af89142d549b35be2a4d218816c584187e9e88219b4e470464fd8ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 4bf1d252206ae223c6500dbd23f608cc833a8c8fa99b2ae268697f29cfefd14a
MD5 71a501221533333287cea76549248843
BLAKE2b-256 ec7aee0839de79cf61d8bfa5aca60630c250043135fb87ba0b55ea5edcc0ae3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymiesim-5.0.0-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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 03ba76ecb512b315bad96507b01b8299775710067e80a922d789a16aaed95cf8
MD5 10651f20f6a2acbf004da83473b74b07
BLAKE2b-256 04b5090b663069f102146895b628e6d4dabacc1af6d1c9311dd9c4e941eb5b87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0aee2b9613d6b5bf86aa70224e3ef6e3f7d17d5acf5914637fb98f5c904e1b00
MD5 2db57893b04efb46fb8b861da4a64777
BLAKE2b-256 8396e4536e1fe7a99b6001d43f2ef9130b0aa34ccaede1577fc3abc6fc9e9afd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pymiesim-5.0.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ecf0e898bfb5bd0a18d124d23da0cb42bf7ebddccf9b7699984ea7d5bd413995
MD5 e3e38afb508b603696875ec0e40e5eb3
BLAKE2b-256 d936cb821367baef5a0226d6c72bb6eda39d396c07bb2ce7897a52dab1715215

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