A lightweight Flask-based web application for visualizing RAYX beamline simulations .
The app allows users to upload an .rml file, trace the beamline using the RAYX Python bindings, and interactively inspect the resulting ray distributions as 2D histograms with per-element breakdowns.
- Upload RAYX
.rmlbeamline definition files - Trace beamlines using the RAYX Python package
- Generate:
- 2D histograms
- Marginal 1D histograms
- indicators (Full Width Half Maximum, Center of Mass)
- Render plots server-side using plotly
- Return plots as Base64-encoded string for easy web embedding
- Python 3
- Flask – web framework
- RAYX – beamline tracing engine
- Plotly – plotting
- NumPy – numerical processing
- Jinja2 – templating
git clone https://github.com/win-vid/rayx-webapp
cd rayx-webapp
Use the main branch for the most stable version.
From the project root run:
uv venv
uv sync
This will:
- Create a virtual environment
- Install all dependencies defined by the project
Run the following to make the web app run locally:
uv run python app.py
You can then access the web app by entering the following address into your web-browser:
http://localhost:5000
You can find an example Metrix beamline under
example_beamline/METRIX_U41_G1_H1_318eV_PS_MLearn_v114.rml.
The application also works with any other beamline encoded in the RAYX .rml format.
Select the beamline and click on "send".
After a short amount of time the server will return the plots of the elements.
The plots are fully interactive.
Click and drag to pan the view.
Use the mouse wheel to zoom in and out centered on the cursor position.
Double-click anywhere inside the plot to reset the view.
The marginal histograms and main 2D histogram stay synchronized while zooming and panning, allowing for intuitive exploration of the beam distribution.
Additionally, plotly allows you to easily download the plot.