Python interface for RAY-UI x-ray tracing program
Project description
raypyng
raypyng is a Python interface for RAY-UI, the ray-tracing software developed at Helmholtz-Zentrum Berlin for synchrotron beamlines and X-ray optics.
It loads a beamline saved from RAY-UI as an .rml file, scans beamline parameters, runs traces in parallel, and post-processes the exported rays.
Highlights
- Works on Linux, macOS, and Windows.
- Drives RAY-UI from Python through a simple simulation API.
- Supports parameter scans and parallel execution.
- Can post-process raw exported rays directly in raypyng.
- Includes automated unit, smoke, platform, and functional tests.
- Offers experimental
rayxbackend support.
Installation
raypyng requires:
- RAY-UI installed on your machine.
- Python 3.10 or newer.
Install the Python package with:
python3 -m pip install --upgrade raypyng
For local development in this repository:
./tools/bootstrap.sh
On Windows PowerShell:
.\tools\bootstrap_windows.ps1
.\.venv\Scripts\Activate.ps1
Notes:
- On Linux,
xvfbis needed for headless RAY-UI execution. - On macOS and Windows,
xvfbis not needed. - On Windows and macOS, put
sim.run(...)underif __name__ == "__main__":when using multiprocessing.
Quickstart
import numpy as np
from raypyng import Simulate
if __name__ == "__main__":
sim = Simulate("rml/dipole_beamline.rml", hide=True)
beamline = sim.rml.beamline
sim.params = [
{beamline.Dipole.photonEnergy: np.arange(200, 2001, 200)},
]
sim.exports = [{beamline.DetectorAtFocus: ["RawRaysOutgoing"]}]
sim.simulation_name = "quickstart"
sim.analyze = False
sim.raypyng_analysis = True
sim.run(multiprocessing="auto", force=True)
This writes the simulation output into a RAYPy_Simulation_quickstart folder.
Experimental rayx support
raypyng can also use rayx as an experimental backend:
pip install "raypyng[rayx]"
The integration is still unstable and should be cross-checked against RAY-UI, especially for beamlines with diffraction gratings.
Tests
The repository includes four kinds of automated tests:
unitsmokeplatformfunctional
See tests/test.md for setup and run commands.
Documentation
- Full documentation: https://raypyng.readthedocs.io/en/latest/index.html
- Installation guide: https://raypyng.readthedocs.io/en/latest/installation.html
- Tutorial: https://raypyng.readthedocs.io/en/latest/tutorial.html
- Troubleshooting: https://raypyng.readthedocs.io/en/latest/troubleshooting.html
Versioning
raypyng follows classic semantic versioning:
MAJORfor incompatible or substantial user-facing changesMINORfor backward-compatible new featuresPATCHfor backward-compatible bug fixes and smaller corrections
Contact
For questions about use rights or licensing, contact Simone Vadilonga:
simone.vadilonga@helmholtz-berlin.de
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raypyng-2.0.0a1.tar.gz.
File metadata
- Download URL: raypyng-2.0.0a1.tar.gz
- Upload date:
- Size: 148.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1cae3bd56d81327b317abba2ca574a3faaf7d0369b5996a671e585f6e736db7
|
|
| MD5 |
2db64c209861b009334604ba2ebce28f
|
|
| BLAKE2b-256 |
f06e03a9709e9995e0ecd58fe3240791a8016154ba9b701ee333b17ac611b45f
|
File details
Details for the file raypyng-2.0.0a1-py3-none-any.whl.
File metadata
- Download URL: raypyng-2.0.0a1-py3-none-any.whl
- Upload date:
- Size: 156.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685e3daedb8a17249419e2f9ea1eba00bc5e5f694e13bebb769632a5e7baa32d
|
|
| MD5 |
d81d1023152d510f09c3177df90a4fb4
|
|
| BLAKE2b-256 |
8317a78ed1628b3fa909a66b2708f4f201c01ae82eafbc1a4a846b75a9ba7f16
|