Skip to main content

Python bindings for the MSTM (Multiple Sphere T-Matrix) Fortran library

Project description

pyMSTM

Python bindings for the MSTM (Multiple Sphere T-Matrix) Fortran library.

Compute electromagnetic scattering from clusters of spheres, including layered media and periodic lattices.

Quick start

import numpy as np
from pymstm import MSTM

# Single dielectric sphere: size parameter x = 5, n = 1.5
m = MSTM()
m.set_spheres(
    radii=[5.0],
    positions=[[0, 0, 0]],
    orders=[12],
    ref_re=[1.5],
    ref_im=[0.0],
)
m.set_medium_ref(1.0, 0.0)
m.set_incident(alpha_deg=0, beta_deg=0)
m.prepare()
result = m.solve()

print(f"Q_ext = {result['qext_tot']:.6f}")
print(f"Q_abs = {result['qabs_tot']:.6f}")
print(f"Q_sca = {result['qsca_tot']:.6f}")

Features

  • Fixed-orientation scattering: per-sphere and total extinction, absorption, scattering efficiencies; 4x4 Mueller matrix at arbitrary angles
  • T-matrix computation: full T-matrix output for use with orientation averaging
  • Random orientation scattering: GSF expansion coefficients and angle-dependent Mueller matrix
  • Layered media: plane boundaries with arbitrary refractive index profiles
  • Periodic lattices: 2D periodic arrays with lattice sums

Installation

# Clone with submodules
git clone --recurse-submodules https://github.com/arunoruto/pyMSTM.git
cd pyMSTM

# Build the Fortran library (requires gfortran)
make

# Install in development mode
pip install -e .

Requirements

  • Python >= 3.11
  • NumPy >= 1.25
  • gfortran (GCC)

Running tests

pip install -e ".[dev]"
pytest tests/

License

MIT. The bundled MSTM Fortran code retains its original license -- see external/mstm/ for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymstm-1.0.0.tar.gz (19.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymstm-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pymstm-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pymstm-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file pymstm-1.0.0.tar.gz.

File metadata

  • Download URL: pymstm-1.0.0.tar.gz
  • Upload date:
  • Size: 19.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for pymstm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3527aa40c02393b421524c2e087830de9314a11831ae8089544bdfbf958d1af6
MD5 f7d2b3c07da188ecb8e89c3fdac8402f
BLAKE2b-256 806b16001df6e82954e1bf2b8acf43d9415f8e689a63b4ac6db262d190135ad5

See more details on using hashes here.

File details

Details for the file pymstm-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: pymstm-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for pymstm-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d58b61574f593c1b04948c54f51455220cfa3cc960b233b2c277fd4fe046347
MD5 427afdb1e960f15a2349041524534706
BLAKE2b-256 4bb5dbf87f59b5e3d18f2187c829dcdac75d64996e31616a8fb85b0927c2a7fe

See more details on using hashes here.

File details

Details for the file pymstm-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: pymstm-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for pymstm-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7bbc5d132e8cfa684e4fcd660b45aecf429a0788b75520a371f4f1549a375e5b
MD5 b4a8930b2a4c4573de2ba1e30a46ec83
BLAKE2b-256 312941f85d6bdedf4152030e2930924300275853d243a32b06d62ba9825fde6a

See more details on using hashes here.

File details

Details for the file pymstm-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: pymstm-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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}

File hashes

Hashes for pymstm-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b4eac432d0a8142cb3ee19642f10509c4f98ffba19b2a8d2b33f3a109e04a87
MD5 fb625d40c7bc66125c4c254285a84c73
BLAKE2b-256 e35a0b73ae77189a1671a05ffddeb806964af95f7402f598ca5ab1398d8b4dd5

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