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.1.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.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymstm-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymstm-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pymstm-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: pymstm-1.1.0.tar.gz
  • Upload date:
  • Size: 19.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pymstm-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9ecb7552701c9345c181ce6757cdd2eb3f77a78a6eefc243605d78f690a134d0
MD5 1017af5aa6f20870e7dd0c2435f3e159
BLAKE2b-256 481bd8d6774527dd33e59d843f9f3d0bb6d7a3cfa83a65207bfb54de558b7ff2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymstm-1.1.0.tar.gz:

Publisher: publish.yml on arunoruto/pyMSTM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymstm-1.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymstm-1.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4c573823dee268b2446bcb10f7ca8711992fca41454f9b1425f52b1a0f8a7aa
MD5 68d896b78f8b46e1499510210f723130
BLAKE2b-256 5567723ee2be57273a6296195a0a9fc118dbd93ba77c5a5b48a5dc25bdb40552

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymstm-1.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyMSTM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymstm-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymstm-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 747cd1ae4c057fc85fda0cf82a0ee0887b07b318242e92e55c1228a6073be6c4
MD5 637f605e47916357831474bc4d9c49f1
BLAKE2b-256 07ea781994b00327841bf0613aa612d0f5f8cb65418754ecd7b23dcbd79d4bc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymstm-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyMSTM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymstm-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymstm-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b4077d551c27d566e2438a631363d29311412ff45cf0f5e8414af813a560b914
MD5 6f736b3fc90479cb9deb53db2acbc403
BLAKE2b-256 d34f6ab4d08797b7b1bf3d44dcbce25bf73a9ba518088891f309ae1bf57966f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymstm-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyMSTM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymstm-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pymstm-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aa759cc47830a4822e247b09b6f9be0f1a63f93523d283af4ea389a187578dd0
MD5 19918f0481ea785da33322218edb0001
BLAKE2b-256 1398a5abd0a82484cc6a1e92df1c9eef36557b504a783138ccf9939b2ccbd246

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymstm-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyMSTM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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