Metadata-Version: 2.4
Name: pyrump
Version: 1.4.0
Summary: Rutherford backscattering spectrometry simulation and analysis, reimplemented in Python
Author-email: Ilya Kostanovski <ilya.kostanovski@mpi-halle.mpg.de>
License: MIT
Project-URL: Homepage, https://github.com/ikost/pyRUMP
Project-URL: Repository, https://github.com/ikost/pyRUMP
Project-URL: Issues, https://github.com/ikost/pyRUMP/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.11
Requires-Dist: matplotlib>=3.8
Requires-Dist: pyreadline3>=3.4; sys_platform == "win32"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pexpect>=4.9; extra == "dev"
Requires-Dist: cffi>=1.16; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs-material<10,>=9.7; extra == "docs"
Dynamic: license-file

# [pyRUMP](https://ikost.github.io/pyRUMP/)

[![PyPI](https://img.shields.io/pypi/v/pyrump.svg)](https://pypi.org/project/pyrump/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/ikost/pyRUMP/blob/main/LICENSE)

![Measured spectrum compared against a pyRUMP simulation, showing a Si / Ru / Mn2.74Pt1 / Ru stack](https://raw.githubusercontent.com/ikost/pyRUMP/main/docs/assets/mnpt-fit.png)
*Measured data (black) vs. a pyRUMP simulation (red) of a Si / Ru / Mn<sub>2.74</sub>Pt<sub>1</sub> / Ru stack.*

A clean Python reimplementation of **RUMP**, the Rutherford backscattering
spectrometry (RBS) simulation and analysis package originally written by
L. R. Doolittle and M. O. Thompson at Cornell.

The original is ~22k lines of unmaintained C from the late 1980s, with no
active support. This reimplementation is written using Claude Code and
reproduces RUMP's physics as a tested, importable Python library, with both
a batch CLI and RUMP's own interactive shell. It runs on Windows, macOS, and
Linux.

Rewriting from scratch with AI assistance is also a chance to move past a
straight port: a handful of bugs in the original C are fixed rather than
just reproduced (validated against the C oracle — see
[RUMP quirks and defects](https://ikost.github.io/pyRUMP/dev/rump-quirks/)),
new physics has been added (Andersen screening alongside RUMP's own
L'Ecuyer correction, via [`SCREENING`](https://ikost.github.io/pyRUMP/manual/config/#screening-new)),
and the workflow is gaining commands RUMP never had, like automatic
per-fit [`REPORT`](https://ikost.github.io/pyRUMP/manual/sim-pert/#pert-commands)
generation. More input formats — SimNRA and NDF — are planned.

## Quick start

```bash
pip install pyrump
```

Requires Python 3.9+; numpy, scipy, and matplotlib are installed
automatically, along with the physics data tables pyRUMP needs at runtime.

```
pyrump                         # the interactive shell, from any directory
Your wish? cd examples
Your wish? xeq MnPt.RBS         /* load the measured spectrum, above    */
Your wish? sim get MnPt.lcm     /* load its 5-layer sample description  */
Your wish? compare              /* data vs. simulation, with residuals  */
```

Buffer 0 is always the simulation and recomputes itself when the sample or
the active buffer's parameters change — there is no "simulate" command,
exactly as in the original.

Or drive it as one-off batch commands:

```bash
pyrump simulate sample.lcm --energy 2.0 --beam 4He -o out.rbs
pyrump fit sample.lcm measured.rbs --vary thickness:0 --window 190 226
pyrump plot measured.rbs --compare out.rbs -o comparison.png
pyrump convert measured.rbs measured.dat
```

## Documentation

The full manual — interactive shell reference, CLI and Python API, worked
examples, the physics writeup, and the list of RUMP quirks and defects found
while porting — is at **https://ikost.github.io/pyRUMP/**.

## Contributing

```bash
pip install -e ".[dev]"
pytest              # unit tests, no external dependencies
ruff check .
```

Oracle-comparison tests (`pytest -m oracle`) need the RUMP C source, which
isn't redistributed here — see [Design and validation](https://ikost.github.io/pyRUMP/dev/validation/).
They skip cleanly when it's absent, so it's not needed for everyday development.

## Licensing and provenance

pyRUMP is MIT licensed, and an **independent reimplementation**: it is not
affiliated with, endorsed by, or derived from the RUMP source distribution.
See [Licensing and provenance](https://ikost.github.io/pyRUMP/dev/about/#licensing-and-provenance)
for the full story, including bundled data-table provenance.
