Skip to main content

A small library handling T-matrices in barycentric rational form compatible to the T-matrix data format.

Project description

barytmat

A small Python library for saving and loading T-matrices in barycentric rational form (equivalent to the pole-expansion form), stored in a format compatible with the daphona T-matrix database.

Background

Electromagnetic scattering properties of particles are fully encoded in their T-matrix. The T-matrix varies smoothly with frequency, and its poles correspond to resonances of the scatterer. barytmat stores a compact pole expansion, for example computed via a matrix-valued AAA algorithm (diffaaable), as an HDF5 file that conforms to the treams/daphona data format. The expansion can then be evaluated at arbitrary frequencies without re-running the full T-matrix calculation.

The method is described in:

J. D. Fischbach et al., Pole-Expansion of the T-Matrix Based on a Matrix-Valued AAA-Algorithm, arXiv:2602.18414 (2026). https://doi.org/10.48550/arXiv.2602.18414

Related publications

Resource Reference
T-matrix database (daphona) N. Asadova et al., arXiv:2602.02101 (2026). https://doi.org/10.48550/arXiv.2602.02101
treams T-matrix package D. Beutel et al., Comput. Phys. Commun. 297, 109076 (2024). https://doi.org/10.1016/j.cpc.2023.109076
Multiple-scattering resonances via AAA J. D. Fischbach et al., Adv. Theory Simul. 8, 2400989 (2025). https://doi.org/10.1002/adts.202400989

Installation

pip install barytmat

or

uv add barytmat

Usage

import numpy as np
import barytmat

# Save a pole expansion to HDF5 (daphona-compatible)
# z_j: pole frequencies (complex), f_j: residues (matrix-valued), w_j: AAA weights
# T0: a treams.TMatrix instance that carries the basis/poltype/material metadata
barytmat.save_hdf5("my_particle.hdf5", z_j, f_j, w_j, T0,
                   description="Gold nanosphere, r=50 nm")

# Load and evaluate at arbitrary frequencies
T = barytmat.load_hdf5("my_particle.hdf5")
Ts = T(k0=np.linspace(0.9e7, 1.1e7, 50))  # array of frequencies

The saved file is a valid daphona/treams HDF5 file. The barycentric weights needed to reconstruct the rational approximation are stored in the file's description attribute so that no sidecar files are required.

Dependencies

  • treams — T-matrix representation and HDF5 I/O
  • diffaaable — differentiable matrix-valued AAA algorithm
  • h5py, numpy

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

barytmat-0.5.1.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

barytmat-0.5.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file barytmat-0.5.1.tar.gz.

File metadata

  • Download URL: barytmat-0.5.1.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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 barytmat-0.5.1.tar.gz
Algorithm Hash digest
SHA256 d2bc87952a8cd04db6c9dcbdd303f770a6a2dd693fbed5de4c21c55d2ada4995
MD5 15da3b4463dfbb34bf46d85c1d9e6284
BLAKE2b-256 c522c9c1b5b38f562dadf60b254f671742db8d1f655e70e4b3a065692678e50d

See more details on using hashes here.

File details

Details for the file barytmat-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: barytmat-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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 barytmat-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27f4f515afded75de38dabc5a9a1fbcfff56e56e6562135e6c259fdf5f1fff8a
MD5 04fd967395c2b34f885f911c51dff8ed
BLAKE2b-256 edb5d535ad62d5eb00746151a8aa4103330b1af7fd2ce03b838b59b1ac4b5cea

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