Skip to main content

Python bindings for FaSTMM2 (Fast Superposition T-Matrix Method, MLFMM-accelerated)

Project description

pyFaSTMM

Python bindings for FaSTMM2 (Fast Superposition T-Matrix Method), a Multi-Level Fast Multipole Method (MLFMM) accelerated solver for electromagnetic scattering from clusters of spheres.

Geometry goes in and Mueller/Jones/cross-section/T-matrix data comes out as plain NumPy arrays -- no input/output files required (unlike the upstream CLI, which reads/writes HDF5).

Quick start

from pyfastmm import FaSTMM2

f = FaSTMM2()

coords = [[-1.5, 0.0, 0.0], [1.5, 0.0, 0.0]]
radii = [1.0, 1.0]
eps = [3.0 + 0.1j, 3.0 + 0.1j]  # permittivity = (refractive index)**2
k = 1.2  # wavenumber

result = f.solve(coords, radii, eps, k, N_theta=91, N_phi=16)
print(f"Cext = {result['c_ext']:.6f}")
print(f"Csca = {result['c_sca']:.6f}")
print(f"Mueller matrix shape: {result['mueller'].shape}")

Features

  • Fixed-orientation scattering: Mueller and Jones matrices, extinction/ absorption/scattering cross sections, asymmetry parameter
  • Orientation-averaged scattering: Halton-sequence orientation averaging
  • T-matrix computation: full T-matrix output (Taa, Tab, Tba, Tbb) for a cluster of spheres
  • MLFMM acceleration: formulation=2 (FaSTMM2, default) scales to large clusters far better than direct superposition T-matrix (formulation=0)

Current scope (v1): spherical (Lorenz-Mie) monomers only -- not the precomputed-per-monomer-T-matrix ("arbitrarily-shaped constituent particles") input the upstream CLI also supports.

Installation

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

# Build the extension (requires gfortran, LAPACK; see devenv.nix/flake.nix)
make f2py-ext

# Install in development mode
pip install -e .

Note: unlike the upstream CLI, the Python extension itself never links HDF5 -- only make cli (the standalone reference binary used by the compatibility tests) needs it.

Requirements

  • Python >= 3.12
  • NumPy >= 1.25
  • gfortran (GCC), LAPACK/BLAS

Running tests

pip install -e ".[dev]"
make cli  # optional: builds the CLI reference binary for compatibility tests
pytest tests/

Dashboard

pip install -e ".[dashboard]"
streamlit run scripts/streamlit_app.py

License

MIT. The bundled FaSTMM2 Fortran code retains its original (BSD-3-Clause/ MIT) licenses -- see LICENSE and external/fastmm2/ 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

pyfastmm-1.0.0.tar.gz (265.5 kB view details)

Uploaded Source

Built Distributions

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

pyfastmm-1.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.9 MB view details)

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

pyfastmm-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.9 MB view details)

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

pyfastmm-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.9 MB view details)

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

pyfastmm-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.2 MB view details)

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

File details

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

File metadata

  • Download URL: pyfastmm-1.0.0.tar.gz
  • Upload date:
  • Size: 265.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyfastmm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 863abd40412ac82fc86bbc44f15f0d910ec2751fb4ac5286a73f4fcebdb9e37d
MD5 e2482adbe63f6247fee7b69b64519598
BLAKE2b-256 cbdf119ae5d8b5b922455f7cd0691eb89e20ff0c4d4ff1e3e520627e751dddb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfastmm-1.0.0.tar.gz:

Publisher: publish.yml on arunoruto/pyFaSTMM

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

File details

Details for the file pyfastmm-1.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyfastmm-1.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0ae29569e8cf5505ac5abd27dd0a6893a1f1646324b5d1a90f4f9bf2faa06363
MD5 309577718b4a39a51e517914f616836f
BLAKE2b-256 7df5d64eec60e1f9db5bd0ea6c2d7310cd4fe8b9bfe3f11779d26409e937eb39

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfastmm-1.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyFaSTMM

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

File details

Details for the file pyfastmm-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyfastmm-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e264a351b27f874ed363b4e8ee8a432591bb3d124510780227b74f08f2b27af2
MD5 a74803e26ef240da79dfbb9a166e6f3c
BLAKE2b-256 7e3bacb046cadad694ad3be03ebd27be70a8b65dbbd0e1f98bade0cc178ffcf0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfastmm-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyFaSTMM

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

File details

Details for the file pyfastmm-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyfastmm-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ad62ea63b352c860289502f77f9dbdcba70cbb565d90c5539dbec3fa9467e5b
MD5 23bf4e6ee2f10113a09b40409ae3e7a0
BLAKE2b-256 305869de5cb6458b3d1f10037acf794b3b0e7bb0179264fd4c6286d1fd3b93b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfastmm-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyFaSTMM

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

File details

Details for the file pyfastmm-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyfastmm-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 92184ab27d0a10acc97ae78ad952975fd7908fc40ab6c640f0c2637b468ac52f
MD5 055358dfacdf870407deb435ec315c62
BLAKE2b-256 45165b9cf78ca892641d2231e6a1eb43253708129fedccaf5e874955614c5cc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfastmm-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on arunoruto/pyFaSTMM

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