Skip to main content

miepython

PyPI GitHub Conda DOI

License Testing Docs Downloads

Try JupyterLite

Mie scattering calculations in pure Python

miepython provides a validated and efficient implementation of Mie scattering for spherical particles. It reproduces established reference results (including Wiscombe’s MIEV0) and is designed for scientific, educational, and computational research applications in optics.

The library implements the full Mie solution, including:

  • extinction, scattering, and absorption efficiencies

  • asymmetry parameter (scattering anisotropy)

  • angle-resolved scattering intensities

  • Mie expansion coefficients

  • complex amplitude functions and Mueller matrices

  • E-field and H-field calculations in the near-field around a sphere

The implementation is numerically stable for a wide range of size parameters and refractive indices, including lossy materials and high-index contrasts.

JupyterLite Implementation

The entire package can be used immediately in a browser — without installation — using the JupyterLite interface:

Try JupyterLite

This environment runs entirely client-side (Pyodide), and supports:

  • interactive notebooks

  • real-time plotting

  • full access to miepython functions

  • reproducible experiments (downloadable notebooks)

This makes it ideal for teaching, demonstrations, or quick exploratory calculations.

Installation

Install with pip:

pip install miepython

Or via conda:

conda install -c conda-forge miepython

Quick Start

A typical calculation is straightforward:

import miepython as mie

m = 1.5 - 0.1j     # refractive index
d = 100            # diameter (nm)
lambda0 = 314.15   # wavelength (nm)

qext, qsca, qback, g = mie.efficiencies(m, d, lambda0)

Documentation and Examples

The full documentation is available on ReadTheDocs:

Docs

Representative results simple examples:

https://github.com/scottprahl/miepython/tree/main/miepython/examples

https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/01.svg https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/02.svg https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/03.svg https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/04.svg https://raw.githubusercontent.com/scottprahl/miepython/main/docs/images/05.svg

Performance and Acceleration

miepython supports optional Numba JIT compilation:

import os
os.environ["MIEPYTHON_USE_JIT"] = "1"  # must be set before import
import miepython

This can provide 10–50× speedups for large parameter sweeps or ensemble calculations.

Benchmark example (100,000 particles):

Version

Time

Speedup

Pure Python

4.00 s

1×

JIT Enabled

0.15 s

27×

Citation

If you use miepython in academic, instructional, or applied technical work, please cite:

Prahl, S. (2026). miepython: Pure python calculation of Mie scattering (Version 3.3.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.7949263

BibTeX:

@software{prahl_miepython_2026,
  author  = {Scott Prahl},
  title   = {{miepython}: A Python library for Mie scattering calculations},
  url     = {https://github.com/scottprahl/miepython},
  doi     = {10.5281/zenodo.7949263},
  year    = {2026},
  version = {3.3.0},
  publisher = {Zenodo}
}

License

miepython is released under the MIT License.

Metadata

Release files for miepython 3.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miepython 3.3.1
File Size Uploaded Provenance Actions
miepython-3.3.1.tar.gz 127.8 kB With provenance Details for miepython-3.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for miepython 3.3.1
File Interpreter ABI Platform Actions
miepython-3.3.1-py3-none-any.whl Python 3 none any Details for miepython-3.3.1-py3-none-any.whl

Total release size: 187.7 kB

Release files / miepython-3.3.1.tar.gz

Download URL miepython-3.3.1.tar.gz
Size 127.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eabe75b370fe8005046ab38a93f0e471bac008473c8151be6ad8fcae8355967b
BLAKE2b-256 checksum
How to use checksums
99cf9ac4ec87ce7f9551b1a1e18c1d8367232fcdc5cab51d13b8506172b7a972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / miepython-3.3.1-py3-none-any.whl

Download URL miepython-3.3.1-py3-none-any.whl
Size 59.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b25761562ac05daaed7dc96e5cd0990171240e8a2bbc249276a1905b431fd76e
BLAKE2b-256 checksum
How to use checksums
fdb9996a0b934c65ba521c49e0cabc8972157647bd20bcb54b9660941d2e169c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for miepython 3.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for miepython-3.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.3.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page