A blazingly fast 4x4 transfer matrix method for simulating reflection though stratified media.
This project is designed to be a fast core backend for simulating reflectivity using the 4x4 transfer matrix method. We are basing the code on the following pre existing codebases, but this is a ground up rewrite.
- refnx - this library is great for simulation reflectivity though scalar media, but fails at tensor indeces.
- refl1d - again, this works great for scal indeces, but is hard to work with in tensor materials, and with buidling complex structures.
This library started as just the pure transfer matrix simulation core but has grown to a full-featured optimized library for polarized energy dependent reflectivity simulation and optimization. We maintain a set of low memory footprint structures used to describe stratified media that are optimized for fast simulation and memory efficiency.
pip install refloxideOr using uv (recommended):
uv add refloxideimport refloxide
print(refloxide.__version__)- Python 3.13+
- uv for package management
git clone https://github.com/HarlanHeilman/refloxide.git
cd refloxide
make installmake test
# With coverage
make test-cov
# Across all Python versions
make test-matrix# Run all checks (lint, format, type-check)
make verify
# Auto-fix lint and format issues
make fixprek install
prek run --all-filesmake docs-serveThis project uses Renovate to keep dependencies up to date automatically. Renovate will open pull requests when new versions of dependencies are available.
To enable it, install the Renovate GitHub App and grant it access to this repository.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.