scatrs
Fast, linearized, rigorously validated single-scattering calculations for spherical and spheroidal particles, written in Rust with a Python interface. The name reads as both "scatterers" and "scat-rs".
scatrs is built out of the scattering core of the sasktran2 radiative transfer model, as a standalone library for the optical properties of particles.
- Mie scattering by homogeneous spheres: coefficients, efficiencies, asymmetry parameter, amplitudes, phase matrix and Greek coefficients to every order.
- Layered spheres: a core and any number of concentric shells (coated spheres among them), with the same outputs and derivatives with respect to every layer.
- Randomly oriented spheroids: efficiencies, Greek coefficients and the six-element phase matrix of oblate and prolate spheroids, by the T-matrix method, converged to a tolerance with an error estimate, and their derivatives.
- Ensembles of spheres and layered spheres: averages over seven kinds of size distribution, external mixtures and batches of distributions, at many wavelengths in parallel, with an error estimate for every output.
- Derivatives of every output, in closed form: with respect to the size parameter and every layer's refractive index, a spheroid's aspect ratio, and for ensembles the distribution parameters, a layered sphere's radius fractions and the mixture weights.
- Validated accuracy: every output has a declared accuracy, checked against independent arbitrary-precision reference values across the validated domain, and against published results.
Installation
pip install scatrs
cargo add scatrs
Example
import numpy as np
import scatrs
from scatrs import mie, tmatrix
# One water droplet: efficiencies, asymmetry parameter and the phase matrix.
q = mie.efficiencies(10.0, 1.33 + 1e-8j) # size parameter, refractive index n + ik
f = mie.phase_matrix(10.0, 1.33 + 1e-8j, np.cos(np.radians([0, 90, 180])))
# A randomly oriented dust spheroid twice as wide as it is tall (aspect ratio a/c = 2).
s = tmatrix.efficiencies(5.0, 1.53 + 0.008j, aspect_ratio=2.0)
print(s.q_ext, s.g, s.error) # the error estimate of each converged T-matrix
# A lognormal aerosol at three wavelengths (µm), with Greek coefficients to order 32.
sulfate = scatrs.Ensemble(
scatrs.Sphere(refractive_index=1.43 + 1e-8j),
scatrs.LogNormal(median_radius=0.08, width=1.6),
)
r = sulfate.compute([0.35, 0.55, 1.0], greek=32)
print(r.c_ext, r.ssa, r.g, r.greek.alpha1[:, :4])
use num_complex::Complex;
use scatrs::mie::{Mie, MieOptions};
let mut mie = Mie::<f64>::new();
let sphere = mie.compute(10.0, Complex::new(1.33, 1e-8), &MieOptions::new())?;
println!("Q_ext = {}", sphere.efficiencies().q_ext);
Documentation
usask-arg.github.io/scatrs: a quick start, examples, the validation of the results, the theory behind every method, and the Python and Rust API references. The Rust API is also on docs.rs.
Contributing
See CONTRIBUTING.md.
License
MIT.
Metadata
Release files for scatrs 0.3.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 | |
|---|---|---|---|
| scatrs-0.3.0.tar.gz | 285.7 kB | Details |
Built distributions (wheels)
Total release size: 11.8 MB
Release files / scatrs-0.3.0.tar.gz
| Download URL | scatrs-0.3.0.tar.gz |
|---|---|
| Size | 285.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaf99fb148e07fe82d792e2fbbec73dd90e9de694000b0a2c33817590377c39d
|
|
BLAKE2b-256 checksum How to use checksums |
873cd36e7739fb01d43c5315b1915e240ade4f9cbe2db44a805b2d83dca735dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-win_arm64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 936.3 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
30565bb66fe45c9306208a89034889abe23bcb4276cee24522b67b314136e21d
|
|
BLAKE2b-256 checksum How to use checksums |
8e027ce3471aa7c3d6f89e285fdbf50fcc4e507d08795fcaaa87daac4803ecb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-win_amd64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a98785745fe404be9111c148c3ad050a9879bfea4381e264237e4c1a0e13d9af
|
|
BLAKE2b-256 checksum How to use checksums |
251fceeecb92fb9df2e28fc5471caaa10239d0807c5e91e80ebfdb052b5a1a55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1a8efd087977b3d0b43338d4b471d9429452e65e124a2c0a835cbb60011445d8
|
|
BLAKE2b-256 checksum How to use checksums |
4fdba0dcc4d79f88b2ee4dcc210131487fe05e38857c192e08df90f20efd7a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
69408b2cc6b6864e72b212bcd0117c34fa72632349c77715439bae613573e983
|
|
BLAKE2b-256 checksum How to use checksums |
a25f2aa6a92867f49c68877a8ea334399608d0fa1480bc6bb1aa56966f9b823a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4acc98743ad89aeb39ab9aa485791f4e63445d4f11956b5d81ff6833d40e7e68
|
|
BLAKE2b-256 checksum How to use checksums |
bb5347b0a0bfeec61d2c5690693c985fc3677e04b5c6af6d2f26974010e3a5f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
| Download URL | scatrs-0.3.0-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ IBM System/390x abi3 |
|
SHA-256 checksum How to use checksums |
ecf18530e63513aad5fcb3ec00b30fe53345a2d5921c2066ceb0df9dce21d4c3
|
|
BLAKE2b-256 checksum How to use checksums |
c58bde285feda75d3c5af6d30d2e0fff8c47e50d3af77a010b47721decade697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
| Download URL | scatrs-0.3.0-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ PowerPC 64-le abi3 |
|
SHA-256 checksum How to use checksums |
4cf90b8c0dde8cfd5f3d3046102b8f114a1f0246dbaf3475e8cc4d45a1501064
|
|
BLAKE2b-256 checksum How to use checksums |
0895846974f9037d8874789b4c9ef240b76fe591194993384449552c78a0329b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7e5fa4b0af3b18740ccbc7c01d487e07838914d79340c48bf00c85742e137091
|
|
BLAKE2b-256 checksum How to use checksums |
0d8decb9c9db0e80bf23ebdca11aa238f9482c3a149bcc6a7242482a7a829add
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4d3995c6b3ccf64a28aa6f4c224d2de188eede780d8b9b7bae34dceb0ae3aacd
|
|
BLAKE2b-256 checksum How to use checksums |
0cac3e7abb94b33f9e336e91448b1416ac25c21f229b87ce479cfc63c102c76b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / scatrs-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | scatrs-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
69dc2123daf68a0795995bb5595399d73b4eb9e6da507becd1a64c3b63339a60
|
|
BLAKE2b-256 checksum How to use checksums |
8a2342077c189074b0c52c7eaa366997b9a7f495881a126f78ac27728807bcad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log