# Advanced optical simulation tools in the OASYS suite and their applications to the design of last generation synchrotron radiation beamlines

Luca Rebuffi, Xianbo Shi, Manuel Sanchez del Rio

► To cite this version:

Luca Rebuffi, Xianbo Shi, Manuel Sanchez del Rio. Advanced optical simulation tools in the OASYS suite and their applications to the design of last generation synchrotron radiation beamlines. Journal of Physics: Conference Series, 2022, 2380 (1), pp.012065. 10.1088/1742-6596/2380/1/012065. hal-05075994

HAL Id: hal-05075994

https://cnrs.hal.science/hal-05075994v1

Submitted on 21 May 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_2.png" /></figure>

PAPER • OPEN ACCESS

Advanced optical simulation tools in the OASYS suite and their applications to the design of last generation synchrotron radiation beamlines

To cite this article: Luca Rebuffi et al 2022 *J. Phys.: Conf. Ser.* **2380** 012065

View the [article online](#) for updates and enhancements.

You may also like

- *Hierarchical multi-level dynamic hyperparameter deformable image registration with convolutional neural network*
  Zhenyu Zhu, Qianqian Li, Ying Wei et al.

- *An optimal adaptive S-transform time-frequency space model for electromagnetic interference complexity evaluation*
  Baiqiang Yin, Fangwen Deng, Ruoyu Wang et al.

- *Effect of chevron nozzle penetration on aero-acoustic characteristics of jet at M = 0.8*
  S R Nikam and S D Sharma

<figure><img src="image_3.png" /></figure>

<figure><img src="image_4.png" /></figure>

<figure><img src="image_5.png" /></figure>

<figure><img src="image_6.png" /></figure>
# Advanced optical simulation tools in the OASYS suite and their applications to the design of last generation synchrotron radiation beamlines

Luca Rebuffi¹*, Xianbo Shi¹ and Manuel Sanchez del Rio²

¹Advanced Photon Source, Argonne National Laboratory, 9700 S. Cass Avenue, Lemont, IL, 60439 USA

²European Synchrotron Radiation Facility, 71, avenue des Martyrs, CS 40220, 38043 Grenoble Cedex 9, France

*lrebuffi@anl.gov

**Abstract.** Since 2013, OASYS (OrAnge SYnchrotron Suite) has been developed as a versatile, user-friendly and open-source graphical environment for modeling X-ray sources, optical systems, and experiments. Its concept stems from the need for modern software tools to satisfy the demand for performing more complex analyses and designing optical systems for 4th generation synchrotron radiation and FEL facilities. The ultimate purpose of OASYS is to integrate in a synergetic way the most powerful calculation engines available to perform virtual experiments in a synchrotron beamline. For X-ray Optics, OASYS integrates different simulation strategies by implementing adequate simulation tools, which communicate by sending and receiving encapsulated data. The OASYS suite has been extensively used in the optical design process for the upgrade projects of several synchrotron radiation facilities worldwide. Several new tools have been created to perform advanced calculations needed for the design of the beamlines and provide accurate specifications for the procurement of the optics.

## 1. Introduction

The multi-bend-achromat (MBA) technology [1] is the foundation of diffraction-limited storage rings (DLSR) and the so-called 4th generation of synchrotron radiation facilities. The MAX IV Laboratory in Lund (Sweden) [2], Sirius at the Laboratório Nacional de Luz Síncrotron (Brasil) [3], the Extremely Brilliant Source (EBS) synchrotron at the European Synchrotron Radiation Facility (France) [4], as well as the Advanced Photon Source Upgrade (APS-U) [5], currently under construction, are all belonging to this new generation. The most significant improvement is the drastic decrease of the horizontal photon source size, leading to the increase of the coherent fraction by more than one order of magnitude. The new facilities can host beamlines designed to exploit the characteristics of the new photon beam, and applications exploiting beam coherence such as X-ray photon correlation spectroscopy, coherent diffraction imaging, propagation-based phase-contrast imaging, and ptychography.

Since 2013, OASYS (OrAnge SYnchrotron Suite) has been developed as a versatile, user-friendly, open-source graphical environment for modeling X-ray sources, optical systems, and experiments [6]. Its concept stems from the need for modern software tools to satisfy the demand to perform more and

<figure><img src="image_7.png" /></figure>
more complex analyses and design optical systems for beamlines of the 4th generation facilities. The ultimate purpose of OASYS is to integrate in a synergetic way the most powerful calculation engines available to perform virtual experiments in a synchrotron beamline.

The OASYS workflow mechanism describes a beamline by representing sources and optical elements as active visual elements, called widgets, and the photon beam as the data content passing through their connections, visible as wires. OASYS is an empty container, while application program interfaces are released as distinct groups of widgets called ‘add-ons’, which users can install individually.

For X-ray Optics, OASYS integrates different simulation strategies by implementing adequate simulation tools, which communicate by sending and receiving encapsulated data [7]. For example, OASYS allows a hierarchical approach to simulate X-ray beamlines [8]: parameters such as flux, dimensions, and intensity distribution of the focused beam, and coherence properties are obtainable from simple analytical calculations via python scripting to sophisticated simulations.

The ray-tracing program ShadowOui [9], the wave optics program SRW [10], the popular XOP [11], and XRayServer [12] are all available in its toolbox, with the possibility of exchanging data and comparing results in the same workspace (see Figure 1). OASYS can also export the visual simulations in the form of Python scripts that, in the case of SRW, can be run into a parallel, multi-core environment without advanced programming knowledge.

<figure><img src="image_8.png" /><figcaption>**Figure 1.** The OASYS graphic user interface showing multiple tools coexisting and interacting on the same workspace.</figcaption></figure>

## 2. Advanced optical simulation tools in OASYS

The OASYS suite has been extensively used in the optical design process for the upgrade projects of several synchrotron radiation facilities worldwide. Several new tools have been created to perform advanced calculations needed for the design of the beamlines and provide accurate specifications for the procurement of the optics.

### 2.1. *Basic loops, scanning loops, and thermal load calculations*

OASYS provides recursive and/or cumulative simulations with loop widgets. Looping can improve the statistical quality of the simulation, for example, avoiding using a single run with a massive number of generated rays in Shadow but executing a series of simulations with a small number of rays and accumulating the result. Another application is to visually execute the SRW multi-electron simulation (partial coherent beam) by running one wavefront at a time and accumulating the intensity of the wavefronts at a desired point.

A looping tool dedicated to ShadowOui is the “Beam Accumulation Point” widget with the function of accumulating good rays during a loop until a desired number of rays or a specific intensity (sum over the rays of the squared modulus of the electric field) of the beam is reached, then sending the accumulated beam to further elements. This widget is particularly useful when the reflectivity of
crystals and mirrors is taken into account, potentially reducing the intensity of the beam to small numbers, despite a statistically relevant number of good rays in the beam.

The scanning loops extend the basic looping mechanism: i) the “Scanning Value Loop” widget creates a cycle on a range of values and a number of steps to subdivide it, to be set at each iteration on a variable of an optical element, ii) the “Scanning File Loop” widget, instead, creates a cycle on a list of files to be set on a specific variable of an optical element. Applications of the widgets are the study of the motor’s resolution response to movements of optical elements (like the pitch angle, for example) or the evolution of the signal as a function of the surface error profile to determine the necessary manufacturing quality of a mirror.

The “Scanning Variable Histogram” widget collects and displays the cumulated results from the scanning loops and calculates statistically meaningful information, like the evolution of sigma (or FWHM) and the relative (or absolute) peak (or integral) intensity of the collected signal.

To easily create a list of error profiles to be inputted in the “Scanning File Loop” widget, the “Multiple Height Profile Simulator” widget has been created, where a collection of error profiles is generated by rescaling the same profile within a range of values of the figure or slope error r.m.s., along the sagittal or tangential direction of a mirror.

Based on the loop mechanism, an advanced feature developed in OASYS is the ab-initio thermal load calculations, described in detail in [13]. The need for a recursive (looping) algorithm relies on the fact that the radiation emitted by an undulator source shows strong photon energy-dependent power and power density distributions in both position and angle. Also, as the radiation propagates along a beamline, it is not only limited by the geometrical acceptance of the beamline elements but also modified in shape and intensity by the interaction with optical elements through reflection, refraction, absorption, and diffraction, all phenomena that show a dependence on the radiation energy and the incident angle. This large variability and reliance on photon energy led to the design of an iterative approach by sampling the energy spectrum of the source radiation. The tool uses the OASYS environment to integrate SRW for the source radiation simulation, ShadowOui for the beam propagation through beamline elements and extends the OASYS loops mechanism to drive the iterative process.

## 2.2. Ray-tracing and wavefront propagation of refractive elements

4th generation, hard x-ray beamlines will utilize many compound refractive lenses, so we found it necessary to add to OASYS the tools to take their manufacturing imperfections into account, properly drive the optical design, and understand their behaviour as a function of the photon energy.

The beamlines 1-BM-B and 28-ID-B at the APS host a fast at-wavelength characterization system to provide accurate, quantitative measurements of lens thickness errors using grating interferometry [14] and a coded-mask-based technique [15]. The software *wavepy2* [16, 17] can be used to reconstruct the phase shift profile induced by the refractive optical elements under inspection and, consequently, their thickness error profile.

OASYS, through the “Thickness File Reader” widget of the SYNED package, not only can read the *wavepy2* output files and make them available for the optical simulation tools but now hosts the add-on OASYS-WavePy2 [18] that can perform the analysis in the same simulation workspace and send the output directly to the optical widgets.

The thickness error profile can be treated in SRW as a “transmission” element, where the key parameters are the transmission amplitude, $e^{-\frac{\Delta t(x,y)}{2la(\lambda)}}$, and the optical path difference, $-\delta(\lambda)\Delta t(x,y)$, where $\Delta t(x,y)$ is the thickness error value, $l_a(\lambda)$ is the attenuation length and $\delta(\lambda)$ is the refractive index decrement at the (photon) wavelength $\lambda$.

ShadowOui uses a similar concept via the HYBRID method [19], where the correction to the Shadow ray-tracing is made by computing the propagation of a wavefront that is not only modulated by the
intensity of the Shadow beam but also the phase shift induced by the thickness error calculated according to the following formula [14]: $\Delta\phi(x, y, \lambda) = -\frac{2\pi}{\lambda}\delta(\lambda)\Delta t(x, y)$.

Figure 2 shows the effect of the thickness error profile on the wavefront and the partial coherent beam, as calculated by SRW.

<figure><img src="image_9.png" /><figcaption>**Figure 2.** Effects of the thickness error profiles of CRLs as calculated by SRW. The simulation results with ideal lenses are shown in the top right, while results from the realistic lenses are on the bottom right. The resulting deformation of the wavefront generates both a broadening of the focal spot and a loss of coherence.</figcaption></figure>

## 2.3. Ray-tracing of a real cylindrical mirror as generated by a bending device

Several 4th generation beamlines will have high-precision bendable mirrors, and some of them will be nanofocusing KB mirrors systems. The latter are extremely sensitive to any source of aberrations, and the magnitude of the deviation from the ideal surface induced by the bender could be, in principle, comparable with the figure error profile of extreme high-quality nanofocusing mirrors where the figure error r.m.s. is less than 1 nm. For this reason, we considered it necessary to model these mirrors as realistic as possible by integrating into the simulation the analytically calculated real surface generated by a dynamical bending device, activated by one or two end couples, and taking into account that the shape of the mirror can be trapezoidal.

The surface profile generated by a bender, and consequently the deviation from an ideal ellipse, can be calculated analytically. The implemented ShadowOui widgets use a non-linear least-square fit of the bent mirror profile described by the equations in [20] and [21], relative to different bending mechanisms, to the required ideal surface profile for a given focal condition. The obtained profile is added to the manufacturing surface error profile, if present, to complete a realistic simulation of the bendable mirror, providing an exceptional level of accuracy in determining the specifications for their design and procurement. The mechanism can be generalized to any optical simulation tool, and it will be available for SRW soon.

## 2.4. The beamline renderer

The “Beamline Renderer” widget is a 3D rendering tool capable of processing the information embedded in the OASYS input/output data and creating an easy, intuitive and realistic visualization of the beamline layout and the optical axis. The widget is activated by simply plugging it into any point
of the beamline. The tool has been developed by extending the matplotlib 3D graphic library [22] to
make it easy to code and fully compatible with OASYS graphic libraries.

The user interface allows manipulating the rendering of the optical elements and improving the visibility according to the users' taste or selecting only a portion of the beamline to magnify details on a region of interest (see Figure 3).

<figure><img src="image_10.png" /><figcaption>**Figure 3.** The Beamline Renderer user interface.</figcaption></figure>

The “Beamline Renderer” widget has been implemented for the add-ons ShadowOui, SRW, SYNED, and WOFRY.

**3. Conclusions**

Keeping in mind the constant increase in the quality of the user experience in using the OASYS suite, the development of several advanced tools has proceeded with large-scale upgrade projects like the EBS and the APS-U. OASYS successfully fulfilled the need for detailed and accurate simulations, providing specifics and data for designing and procuring many different kinds of optical and radiation safety system elements. The OASYS suite hosts accurate and extremely realistic optical simulations that have been used to provide detailed information not only from an optical point of view but also thermal and mechanical, proving to be a powerful support for all the different design phases of a new synchrotron radiation facility. OASYS has been and will be constantly improved, and new features are already under development. We are currently working on improving the export tools of the simulations in the form of python scripts, integrating more and more advanced features. We used these features to easily and automatically provide the python code to execute OASYS simulations in parallel computing environments, or to provide templates to code digital twins of synchrotron beamlines as a support tool to the development of applications driven by Artificial Intelligence (AI). In addition, a new version of the popular software Shadow, fully coded in python, will be released soon in OASYS, by the name Shadow4. This new version will integrate many suggestions and requests from the OASYS users' community.

**Acknowledgments**

We want to thank all the OASYS users who, for several years, contributed with their enthusiasm and suggestions to the significant advancement of this tool, allowing it to be diffused and successfully adopted worldwide. In particular, we are sincerely grateful to our colleagues at the APS, that provided invaluable support during the development of the most advanced and new features. With endless
appreciation and affection, we like to acknowledge that OASYS would have never become such an
essential tool without Dr. Ruben Reininger’s foresight, who first understood its potential, mentored the
developers since the first released prototype, and provided countless ideas, tools, and tests. He more
than deserved his retirement, but his presence at the APS is greatly missed. We warmly thank Laura E.
Atseff for proofreading this paper. This work was supported by the US Department of Energy, Office
of Science, Office of Basic Energy Sciences, under contract DE-AC02-06CH11357.

References

[1] Einfeld D, Plesko M and Schaper J. 2014 *J. Synchrotron Rad.* **21**, 856–861

[2] Cerenius Y, Hennies F and Fernandes Tavares P 2016 *Synchrotron Radiation News*, **29**:1, 34-38

[3] Liu L, Neuenschwander RT, Rodrigues ARD 2019 *Phil. Trans. R. Soc. A* **377**:20180235

[4] Dimper R, Reichert H, Raimondi P, Sanchez Ortiz L, Sette F and Susini J 2014 *ESRF Upgrade Programme Phase II*. http://www.esrf.eu/Apache_files/Upgrade/ESRF-orange-book.pdf (last visited 04/15/2022).

[5] VV.AA. 2019 *APS-U Final Design Review Report*. https://www.aps.anl.gov/APS-Upgrade/Documents (last visited 04/15/2022).

[6] Rebuffi L and Sanchez del Rio M 2017 *Proc. SPIE* **10388**, 130080S

[7] Rebuffi L and Sanchez del Rio M 2017 *Proc. SPIE* **10388**, 130080

[8] Sanchez del Rio M, Celestre R, Glass M, Pirro G, Reyes Herrera J, Barrett R, da Silva JC, Cloetens P, Shi X and Rebuffi L 2019 *J. Synchrotron Rad.* **26**, 1887-1901

[9] Rebuffi L and Sánchez del Río M 2016 *J. Synchrotron Rad.* **23**, 1357-1367

[10] Chubar O, Fluerasu A, Berman L, Kaznatcheev K and Wiegart L 2013 *J. Phys. Conf. Ser.* **425**, 162001

[11] Sanchez del Rio M and Dejus RJ 2011 *Proc. SPIE*, **8141**, 814115

[12] Stepanov SA 2004 *Proc. SPIE* **5536**, 553611

[13] Rebuffi L, Shi X, Sanchez del Rio M and Reininger R 2020 *J. Synchrotron Rad.* **27**, 1108-1120

[14] Shi X, Grizolli W, Shu D, Rebuffi L, Islam Z and Assoufid L 2019 *Proc. SPIE* **11109**, 111090K

[15] Qiao Z, Shi X, Wojcik MJ, Rebuffi L and Assoufid L 2021 *Appl. Phys. Lett.* **119**, 011105

[16] Grizolli W, Shi X, Assoufid L and Butler LG 2019 *AIP Conference Proceedings* **2054**, 060017

[17] https://github.com/APS-XSD-OPT-Group/wavepy2

[18] https://github.com/APS-XSD-OPT-Group/OASYS1-WavePy2

[19] Shi X, Reininger R, Sanchez del Rio M, Assoufid L, 2014 *J. Synchrotron Rad.* **21**, 669–678

[20] Howells MR, Cambie D, Irick SC, MacDowell AA, Padmore HA, Renner TR, Rah SY and Sandler R 2000 *Optical Engineering* **39**(10)

[21] Eng PJ, Newville M, Rivers ML and Sutton SR 1998 *Proc. SPIE* **3449**, 145-156

[22] Hunter JD 2007 *Computing in Science & Engineering*, **9**(3), 90-95