MiePy
MiePy is a Python module for the generalized multiparticle Mie theory (GMMT), also known as the aggregate T-matrix method. MiePy solves the electrodynamics of a collection of spherical or non-spherical scatterers with an arbitrary incident source.
Electric field around a 37 particle cluster
3D electric field contours around three metal nanoparticles
Features
- Non-spherical particles using the T-matrix formulation via the extended boundary condition method (EBCM). Includes cylinders, spheroids, ellipsoids, cubes and polygonal prisms
- Arbitrary incident sources (plane waves, Gaussian beams, HG and LG beams, point dipoles)
- Evaluation of cluster cross-sections and optical force and torque on individual particles
- Periodic boundary conditions with various lattice types (square, hexagonal, etc.) and mirror and discrete rotational symmetries for faster calculations
- Optional planar interface (substrate)
- 3D scene visualization using the VPython library
- Image clusters using a simulated microscope
- OpenMP parallelization for systems with larger numbers of particles
Installation
pip install miepy
If using uv:
uv venv --python 3.13
uv pip install miepy
source .venv/bin/activate
GPU Backend (optional)
To use the GPU-accelerated solver backend:
pip install miepy[gpu]
Then activate the GPU backend:
import miepy
miepy.backends.set_backend('gpu')
Usage
See the examples folder for how to use MiePy.
Run any of the available examples without explicit installation using uv:
| Command | Description |
|---|---|
uvx miepy dielectric_sphere |
Dielectric sphere scattering and cross-sections |
uvx miepy ag_sphere |
Silver sphere scattering and absorption |
uvx miepy ag_shell |
Core-shell particle scattering |
uvx miepy vary_index |
Scattering intensity vs wavelength and refractive index |
uvx miepy fields |
Electric and magnetic field visualization |
uvx miepy dimer_scattering |
Au dimer cross-sections |
uvx miepy dimer_force |
Force and torque on dimer particles |
uvx miepy far_field |
Far-field radiation patterns |
uvx miepy whispering_gallery |
Whispering gallery modes in dielectric sphere |
uvx miepy focused_gaussian |
Focused Gaussian beam with orbital angular momentum |
uvx miepy imaging |
Near-field, far-field, and microscope imaging |
For an overview of the theory, see docs folder.
Install from source
MiePy uses vcpkg for C++ dependency management and uv for Python management, which simplifies building across platforms.
Prerequisites:
- GCC
- uv
Build steps:
- Clone MiePy and its submodules:
git clone https://github.com/johnaparker/miepy.git miepy --recurse-submodules && cd miepy
- Bootstrap vcpkg (first time only):
./vcpkg/bootstrap-vcpkg.sh
- Install MiePy using uv:
uv sync
- Optionally, run the tests to verify correctness:
uv run pytest tests
License
MiePy is licensed under the terms of the GPLv3 license.
Release files for miepy 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| miepy-1.1.0.tar.gz | 7.5 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| miepy-1.1.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ x86-64 | Details |
| miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 15.0+ ARM64 | Details |
| miepy-1.1.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl | CPython 3.12 | CPython 3.12 | macOS 15.0+ x86-64 | Details |
| miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 15.0+ ARM64 | Details |
| miepy-1.1.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ x86-64 | Details |
| miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ ARM64 | Details |
Total release size: 92.1 MB
Release files / miepy-1.1.0.tar.gz
| Download URL | miepy-1.1.0.tar.gz |
|---|---|
| Size | 7.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbe304b54062d4737c299487004c6caf768d0a598326eaf1d17c975557ac2e35
|
|
BLAKE2b-256 checksum How to use checksums |
8557eb60b5244e0341a4116bf208e20e3cadfcbc0c146f43334712db996e4c9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp313-cp313-win_amd64.whl
| Download URL | miepy-1.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
16a96ed7168481fea3e4acfb377053e0c1039099c6b89750657d3fa56cba55f5
|
|
BLAKE2b-256 checksum How to use checksums |
ead58db93933b67fa843bde0be1e1441e10eeaa72021f960fb8623d6bf89465f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c45c3ad1c99a376048f1dd06735b81b79a09f6384b1f7167a3c70ddc57d833d0
|
|
BLAKE2b-256 checksum How to use checksums |
6e71300f50ea14790e3443e74044f0b6944bb7092233ef701879cfacf680c4e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl
| Download URL | miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | CPython 3.13 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
a3239bda42e4810f3f15f4d01760f3203e4403bdf1375f3c8d48de11ba099100
|
|
BLAKE2b-256 checksum How to use checksums |
4287ecb5ddc1f6e913a89e894da60a626bdeff93d999dc5df25d65e8320a8c61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
165d9e83f7b9b76eaa99770b1e42449f8319fc0fd4b9ab6bba837d2b72a69c15
|
|
BLAKE2b-256 checksum How to use checksums |
b659961793a5b608c42bfd419c22aead56b69f9d2d6aea7cdf4fbbc7ddefc368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp312-cp312-win_amd64.whl
| Download URL | miepy-1.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5ad486ffebe4d09519628b8f084d6348ccf4bc6dcb0a5d7a9a28f935d5d4ace8
|
|
BLAKE2b-256 checksum How to use checksums |
0b45fc46e591d119167788fdbd6532d59c43531f7ec4c2ac8f31b2dcab5e795d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3c35171f8502c4229c3bb28d6ab6a1795e20f6ebb60abed14012065ab0ba6320
|
|
BLAKE2b-256 checksum How to use checksums |
5a2bb245f757d86553043a5132ebaceba2319d413298737becb1c9fcfa8be670
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl
| Download URL | miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | CPython 3.12 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
29307133a1c9ae363dca38d857a7491e2ef56f27ab4b40dd1f94f91d3ff727a4
|
|
BLAKE2b-256 checksum How to use checksums |
1412fcbdf50b9e0aedf9cd752bc0d66f45489c49e77d5558d7bd7ed6dad0043d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0f3cbfd9ad1f0d7dcb22a50db9cce25d237e97fca7778be136636b35eeca61ec
|
|
BLAKE2b-256 checksum How to use checksums |
256b8e9adf8e3fd5743241c66717953021ba36dd3ffcea83238e21f676691a0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp311-cp311-win_amd64.whl
| Download URL | miepy-1.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ac5be2e3b90a58334c0759d152e8295a6ded99e1d4b583204499613d4c36e413
|
|
BLAKE2b-256 checksum How to use checksums |
23c1d525fe07db00d4fd9554ece1de29354f0ad7c9bb7248c24f3de2bca77fe4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b840b5cddc17a80de63280a4dfa504bdc5ff4228f4ed9af8b78d457b98eb0d04
|
|
BLAKE2b-256 checksum How to use checksums |
1bbaf35c14bd2f47b3f61bd45b84499c77aebab73666b779ff2b1dc9583ec43c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl
| Download URL | miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | CPython 3.11 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
b9280cbb6068e361fd1243a6783a48f94ff94840cf12ddbb8045533df22609f0
|
|
BLAKE2b-256 checksum How to use checksums |
5050953e35f6f13757bcc5a6ee788e9b1991904d24fc8cc5603898751460776a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ef6d76c2b5d4aecb23bcfa887257ad8bf179b4336fd335f0879fc0a5fcc20eee
|
|
BLAKE2b-256 checksum How to use checksums |
334ca2e2df0d5852837f2436add6288329ff933145ceef7c9a1d66571555ac42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|