Skip to main content

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 rayx backend support.

Installation

raypyng requires:

  1. RAY-UI installed on your machine.
  2. 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, xvfb is needed for headless RAY-UI execution.
  • On macOS and Windows, xvfb is not needed.
  • On Windows and macOS, put sim.run(...) under if __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:

  • unit
  • smoke
  • platform
  • functional

See tests/test.md for setup and run commands.

Documentation

Versioning

raypyng follows classic semantic versioning:

  • MAJOR for incompatible or substantial user-facing changes
  • MINOR for backward-compatible new features
  • PATCH for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raypyng-2.0.0a1.tar.gz (148.8 kB view details)

Uploaded Source

Built Distribution

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

raypyng-2.0.0a1-py3-none-any.whl (156.5 kB view details)

Uploaded Python 3

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

Hashes for raypyng-2.0.0a1.tar.gz
Algorithm Hash digest
SHA256 a1cae3bd56d81327b317abba2ca574a3faaf7d0369b5996a671e585f6e736db7
MD5 2db64c209861b009334604ba2ebce28f
BLAKE2b-256 f06e03a9709e9995e0ecd58fe3240791a8016154ba9b701ee333b17ac611b45f

See more details on using hashes here.

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

Hashes for raypyng-2.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 685e3daedb8a17249419e2f9ea1eba00bc5e5f694e13bebb769632a5e7baa32d
MD5 d81d1023152d510f09c3177df90a4fb4
BLAKE2b-256 8317a78ed1628b3fa909a66b2708f4f201c01ae82eafbc1a4a846b75a9ba7f16

See more details on using hashes here.

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