Skip to main content

A blazingly fast 4x4 transfer matrix method for simulating reflection though stratified media

Project description

refloxide

CI PyPI version codecov Python 3.13+ uv Ruff ty License: GPL-3.0 Renovate

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.

We are basing this library on this paper:

Core philosophy

This library is designed as a pure functional simulation core. A caller defines a structure as fronting medium, backing medium, and a sequence of interior layers with thickness, interfacial roughness, and refractive-index parameterization. The solver then evaluates reflectivity for a requested set of experimental coordinates (for example angle, energy, or wavelength), and returns deterministic numerical arrays with no hidden mutable state.

The design intent is:

  • Explicit physical inputs with validation at construction time.
  • Predictable outputs for scalar and vectorized evaluation paths.
  • Single-threaded execution as the default, so this engine composes cleanly inside larger fitting and orchestration systems that already manage parallelism.
  • Strict separation between geometry (Structure), optical parameterization (n), and propagation numerics (4x4 transfer-matrix kernels).

In short, refloxide should behave like a reliable computational kernel: give it a fully specified layered system and a measurement grid, and it returns reproducible reflectivity without side effects.

Features

  • Fast and modern Python toolchain using Astral's tools (uv, ruff, ty)
  • Type-safe with full type annotations
  • Comprehensive documentation with MkDocs — View Docs

Installation

pip install refloxide

Or using uv (recommended):

uv add refloxide

Quick Start

import refloxide

print(refloxide.__version__)

Development

Prerequisites

  • Python 3.13+
  • uv for package management

Setup

git clone https://github.com/HarlanHeilman/refloxide.git
cd refloxide
make install

Running Tests

make test

# With coverage
make test-cov

# Across all Python versions
make test-matrix

Code Quality

# Run all checks (lint, format, type-check)
make verify

# Auto-fix lint and format issues
make fix

Prek

prek install
prek run --all-files

Documentation

make docs-serve

Dependency Updates

This 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.

License

This project is licensed under the GPL-3.0 License - see the LICENSE file 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

refloxide-0.1.3.tar.gz (223.0 kB view details)

Uploaded Source

Built Distributions

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

refloxide-0.1.3-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436.7 kB view details)

Uploaded CPython 3.15manylinux: glibc 2.17+ x86-64

refloxide-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

refloxide-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

File details

Details for the file refloxide-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for refloxide-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d464f6182361d00514eb8c9befda58a7c83c6ee63f7f5316dc3c8878ec5b8c56
MD5 5c6969020d183514c00f71c39d91f8dc
BLAKE2b-256 cf5d70d5f0ff92ed9346e15c7c6a9b76fa1fc0c1c13abadd644e2074f37b675f

See more details on using hashes here.

Provenance

The following attestation bundles were made for refloxide-0.1.3.tar.gz:

Publisher: release.yml on ALS-RSOXS/refloxide

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

File details

Details for the file refloxide-0.1.3-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for refloxide-0.1.3-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f13788a2723aa7b3f5d5165648fbad9b4a76c298e81f4e38bb56e2c6f2ecd95
MD5 f5f42e67ffffde79c3a7f59b3975c9f8
BLAKE2b-256 379049bc158a6dd8d4ef303f5e0a029c29d6b4167e0326fa8bb4cf3292744c5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for refloxide-0.1.3-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ALS-RSOXS/refloxide

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

File details

Details for the file refloxide-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for refloxide-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 751a167602e5270a8e8871c2f513aebcb22a036b3f6979d625903bf212b72109
MD5 103f05942bf1eb929c7c4e98616d5a87
BLAKE2b-256 a0aa792857a6172e0063ef0354803e4f64670cc47420bbeac703690a21a24026

See more details on using hashes here.

Provenance

The following attestation bundles were made for refloxide-0.1.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ALS-RSOXS/refloxide

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

File details

Details for the file refloxide-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for refloxide-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30823cfeb05b7551c8ae71ed161d23a4c3f7f8968fb4e4fd1560164ef5d65524
MD5 c55485f19fb1aed011889269df59b607
BLAKE2b-256 0a58d245943d683d8d83d26991f96cd98f9bd277e34312f6e3193c810ae1f581

See more details on using hashes here.

Provenance

The following attestation bundles were made for refloxide-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on ALS-RSOXS/refloxide

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