Metadata-Version: 2.4
Name: mass-screen-rs
Version: 0.1.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Dist: numpy>=2.0.0
Requires-Dist: mass-screen-rs[tests,docs] ; extra == 'dev'
Requires-Dist: sphinx>=8 ; extra == 'docs'
Requires-Dist: furo ; extra == 'docs'
Requires-Dist: sphinx-copybutton ; extra == 'docs'
Requires-Dist: pytest ; extra == 'tests'
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: tests
License-File: LICENSE
Summary: Rust backend for the MUSE data-driven response mask (mass screen)
Author-email: Nabil Freij <nabil.freij@gmail.com>
License-Expression: BSD-3-Clause
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://mass-screen-rs.readthedocs.io
Project-URL: Issues, https://github.com/LM-SAL/mass-screen-rs/issues
Project-URL: Source, https://github.com/LM-SAL/mass-screen-rs

# mass-screen-rs

The MUSE data-driven response mask ("mass screen") with a Rust core and a Python API.

`mass_screen(response, spectra, threshold=..., fill_value=...)` takes the response matrix
`[n, m]` (spectral pixel × VDEM component) and the spectra `[n, b]` (spectral pixel × image
pixel) and returns a float32 array `[b, m]` with 1.0 where a component can produce at least
`threshold` of signal for that pixel and NaN where it cannot, after replacing spectra `<= 0` by
`fill_value`. It computes the same mask as the PyTorch reference in `muse.inversions` and
replaces the C++ kernel muse used to build at install time. The tests check it against a recorded
PyTorch mask.

## Install

```bash
pip install mass-screen-rs
```

Wheels are published for Linux (x86-64), macOS (arm64) and Windows, Python 3.12 to 3.15.

## Development

```bash
pip install maturin pytest
maturin develop --release        # build into the active environment
cargo test                       # Rust unit tests
pytest --pyargs mass_screen_rs   # Python tests, including parity with the recorded PyTorch mask
prek run --all-files             # lint hooks (ruff, docformatter, cargo fmt, clippy, cargo test)
```

With `torch` installed, the parity test also checks a fresh random case against PyTorch directly,
and `python -m mass_screen_rs.tests.make_torch_reference` re-records the reference.

Releases: bump `version` in `Cargo.toml` (the only place it is set), merge, then tag `vX.Y.Z` on
`main`; the workflow builds the wheels and the sdist and uploads them to PyPI.

