원시데이터 수집 시스템
선정목록으로

Offset Finding of Beamline Parameters on the METRIXS Beamline at BESSY II Using Machine Learning

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. David C. Meier — Artificial Intelligence Methods for Experiment Design (AIM-ED), Joint Lab Helmholtz-Zentrum für Materialien und Energie, Berlin (HZB) and University of Kassel|||Helmholtz-Zentrum für Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany
  2. Thomas Zeschke — Helmholtz-Zentrum für Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany
  3. Peter Feuer-Forson — Helmholtz-Zentrum für Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany
  4. Bernhard Sick — Artificial Intelligence Methods for Experiment Design (AIM-ED), Joint Lab Helmholtz-Zentrum für Materialien und Energie, Berlin (HZB) and University of Kassel|||Intelligent Embedded Systems, University of Kassel, Wilhelmshöher Allee 73, 34121 Kassel, Germany
  5. Jens Viefhaus — Helmholtz-Zentrum für Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany
  6. Gregor Hartmann — Artificial Intelligence Methods for Experiment Design (AIM-ED), Joint Lab Helmholtz-Zentrum für Materialien und Energie, Berlin (HZB) and University of Kassel|||Helmholtz-Zentrum für Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany
DOI
10.1088/1742-6596/3010/1/012130
저널
Journal of Physics Conference Series
발행년도
2025
발행기관
IOP Publishing
피인용수
1
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1088/1742-6596/3010/1/012130
토픽
Advancements in Photolithography Techniques
OpenAlex ID
W4411063164

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Abstract Beamline alignment is challenging as the beamline components must be set up ideally so that the rays follow the desired optical path. Automated methods using a digital twin allow for faster diagnostics and improved beam properties compared to manual tuning. We introduce an automated method of finding the offsets to improve this digital twin model. These offsets represent the unknown but constant differences between the beamline parameter positions as set up at the physical beamline and the corresponding parameter positions of its digital twin. Our method assumes the capability to execute precise relative movements with a known step size for these parameters, although the absolute position information is unknown. By combining the surrogate model with a global optimizer, we successfully determine offsets for 34 beamline parameters on a simulated METRIXS beamline at the BESSY II synchrotron radiation source in Berlin.

본문 25,163자

본문 펼치기
## Offset Finding of Beamline Parameters on the METRIXS Beamline at BESSY II Using Machine Learning David Meier <sup>1</sup> <sup>_,_</sup> <sup>3</sup> , Thomas Zeschke <sup>1</sup> , Peter Feuer-Forson <sup>1</sup> , Bernhard Sick <sup>2</sup> <sup>_,_</sup> <sup>3</sup> , Jens Viefhaus <sup>1</sup> and Gregor Hartmann <sup>1</sup> <sup>_,_</sup> <sup>3</sup> 1Helmholtz-Zentrum f¨ur Materialien und Energie GmbH, Albert-Einstein-Straße 15, 12489 Berlin, Germany 2Intelligent Embedded Systems, University of Kassel, Wilhelmsh¨oher Allee 73, 34121 Kassel, Germany 3Artificial Intelligence Methods for Experiment Design (AIM-ED), Joint Lab Helmholtz-Zentrum f¨ur Materialien und Energie, Berlin (HZB) and University of Kassel E-mail: david.meier@helmholtz-berlin.de Abstract. Beamline alignment is challenging as the beamline components must be set up ideally so that the rays follow the desired optical path. Automated methods using a digital twin allow for faster diagnostics and improved beam properties compared to manual tuning. We introduce an automated method of finding the offsets to improve this digital twin model. These offsets represent the unknown but constant differences between the beamline parameter positions as set up at the physical beamline and the corresponding parameter positions of its digital twin. Our method assumes the capability to execute precise relative movements with a known step size for these parameters, although the absolute position information is unknown. By combining the surrogate model with a global optimizer, we successfully determine offsets for 34 beamline parameters on a simulated METRIXS beamline at the BESSY II synchrotron radiation source in Berlin. 1 Introduction A synchrotron beamline consists of many components: mirrors, slits, gratings, crystals, and alignment units. Thus, many configurations must be tuned and optimized, which is time-consuming and requires expert knowledge. Because the beamline setup changes regularly, the beamline alignment must be carried out regularly up to daily. Thus, a one-click solution for automatically returning to the beamline’s optimal state within minutes instead of hours of manual tuning is desirable. We need a _digital_ _twin_, a virtual representation of a real-world beamline to provide such an approach. For this digital twin, we use a raytracing software that takes beamline configurations as input to calculate footprints—point clouds of ray coordinates at the end of the beamline. The beam transmitted through the beamline consists of many rays with slightly different coordinates and trajectories. The raytracing software simulates the trajectories of these rays from the light source through all optical elements to the end of the beamline. The measurements carried out using a focus measurement chamber at the real-world beamline correspond to the calculated footprints of the digital twin. However, discrepancies between the real-world beamline and the digital twin arise due to manufacturing inaccuracies. Additionally, alignments of the beamline components are in millimeter to micrometer scale, while a typical beamline is at the scale of tens of meters, prohibiting precise adjustments of these components in the real world. We call these differences, which are fixed for all configurations, _offsets_ . Once the offsets are found, the digital twin—corrected by these offsets—can be used to optimize the beam properties to desired targets. Application phase Error of beamline outputs and surrogate outputs <u>Training phase</u> is trained with Offset Finder Surrogate Proposed offsets + beamline configurations … Parameters Surrogate Model Figure 2: The beamline parameters are inputs to the neural network surrogate model, with histograms of the footprints as outputs. Simulation Dataset Tool many runs many runs Figure 1: Architecture of our proposed approach. This study presents a method to find automatically the offsets for various beamline parameters. To gather sufficient information about the current parameter offsets, we manually search for multiple parameter configurations with many rays visible on the measurement chamber screen. This procedure is essential since only such configurations are expressive for offset finding. If few or no rays reach the end of the beamline, this footprint could result from many parameter configurations and thus provides insufficient information gain. An overview of the offset finding process is given in Fig. 1. During the application phase, the offset finder suggests offsets, which are added to the previously determined beamline configurations with high ray counts. The configurations corrected by the proposed offsets must be simulated and compared with the footprints of the real-world beamline to evaluate the quality of the proposed offsets. Since the digital twin with 1-2 seconds evaluation time is too slow for this task, we replace it with a _sur-_ _rogate_ _model_, a fast simulation approximation. This surrogate model is trained once during the training phase and can be repeatedly used for the offset-finding process in the application phase. For the surrogate model, we train a neural network with a dataset that contains many randomly selected combinations of the investigated beamline parameters and their results from the digital twin. To further accelerate the training and evaluation of the neural networks, we map the beamline configurations not to the footprints but their _x_ and _y_ histograms, which are binned projections along the _x_ and _y_ axes, as shown in Fig. 2. The offset finder uses the surrogate model to evaluate quickly the beamline configurations corrected by different proposed offsets, compares them to the outputs of the real-world beamline, and quantifies the errors. The offset finder then uses these errors to suggest new offsets to be evaluated. This process is repeated until the error between the beamline and surrogate model outputs becomes sufficiently small. We demonstrate our approach on the Momentum and Energy resolved Resonant Inelastic X-ray scattering at molecular Systems (METRIXS) beamline at Berliner Elektronenspeicherring f¨ur Synchrotronstrahlung II (BESSY II) [1] and use the simulation tool RAY-UI [2] as a digital twin. As a proof of concept we test our approach not on the real-world beamline but on a beamline simulated with RAY-UI using imitated random offsets. This approach enables rapid testing with known offsets and prevents technical issues like unknown incorrect motor directions leading to wrong signed mirror alignments. 2 Related Work Since beamline optimization is a frequent task in all synchrotron radiation sources, numerous attempts are made to optimize automatically the beamline parameters. One approach is based on genetic algorithms [3]. This approach is significantly restricted in the range of beamline parameter intervals and in the maximum amount of 15 optimized beamline parameters. Furthermore, only the parameters of two mirrors and one monochromator are optimized. Karaca et al. compare several optimization methods: genetic algorithms, non-dominated sorting genetic algorithm II, particle swarm optimization, and artificial bee colony [4]. While particle swarm optimization achieves the best results in this study, its significance is limited, as only the focal distances of two mirrors are optimized. Another method that is applied is Bayesian optimization [5]. These experiments are successfully applied for up to eight beamline parameters. Although the problem space is constrained, scaling Bayesian optimization to higher dimensions remains challenging due to its exponentially increasing computational complexity. In summary, existing beamline optimization approaches are constrained by the number of optimized beamline parameters or are restricted to narrow parameter intervals. These restrictions are required to limit the dimensionality and optimization problem space. All described approaches require parameter evaluations at the actual beamline, as no digital twin exists or offsets compensation is not applied to this digital twin. Determining fixed parameters like mirror radii or slope errors is impossible without matching a virtual twin to the real-world beamline. Furthermore, the possible evaluation number is limited, as realworld beamline evaluations take several seconds, rendering the process too slow for efficient optimization. We train a surrogate model similar to Nash et al. [6] to avoid this bottleneck. Because our surrogate model is a neural network, it is differentiable and, thus, allows the use of gradient-based optimizers. Neural networks also enable batch-wise evaluations on Graphics Processing Units (GPUs), allowing rapid processing of large numbers of evaluations. Due to these properties our offset finder can find global minima by evaluating millions of beamline parameters per second, using an optimizer similar to a random walker approach. In this study, we do not optimize the beamline parameters but focus on identifying the discrepancies between reality and simulation. Optimizing the beamline parameters based on these discrepancies is then straightforward, as it involves defining the desired target footprints and using the same optimizer as in the offset-finding process after adjusting the found offsets of the fixed parameters in the surrogate model. However, this aspect extends beyond the scope of the current work. 3 Method _3.1_ _Surrogate_ _Model_ We use a neural network for the surrogate model that replaces the computationally intense raytracing simulation tool, taking the beamline configurations as inputs and generating only the _x_ and _y_ histograms of the footprints, unlike the replaced simulation tool. To calculate the _x_ and _y_ histograms, we divide the intervals of possible values of _x_ and _y_ into _k_ equally sized bins, counting how many rays are within the specified bin, as shown in Fig. 2. We use _k_ = 50 bins for the _x_ histograms over the interval [ _−_ 10 _,_ 10] mm, and _k_ = 50 bins for the _y_ histograms over the interval [ _−_ 3 _,_ 3] mm. These intervals cover the majority of rays while maintaining high positional accuracy. Unlike the simulation tool, the surrogate model is specific to the beamline and limited to the parameter ranges as defined in Tab. 1. We create a dataset with uniformly random sampled beamline parameters from Tab. 1 to train the neural network. These parameters are simulated using RAY-UI with 100 000 input rays, and their _x_ and _y_ histograms are stored in this dataset. We refer to each specific input constellation, as described in Tab. 1, combined with the RAY-UI simulation result, as a sample. We create a large dataset of 20 million samples, as approximately 95% of the beamline parameter combinations within our selected intervals result in a nearly empty footprint. We aim to ensure the dataset includes a sufficient number of samples—around 1 million—with footprints that contain enough rays for an effective training. The number of required samples could potentially be lower, so further investigation is needed to determine the optimal dataset size. From 80% of the dataset, we select samples containing at least one ray. From the remaining 20%, we select all samples including empty footprints. We apply this approach for faster dataloading and to speed up training because the dataset is very imbalanced, with samples containing rays being significantly rarer than those without rays. To further address data imbalance, we divide the data into “good” and “bad” groups of samples, where the former is comprised of almost 1 million samples containing at least ten rays, and the latter is comprised of those containing less. Samples are shown to the network with a ratio of 3:1 good to bad samples. A threshold below ten rays for this classification increases the Mean Squared Error (MSE) for non-empty histograms, while higher thresholds increase the overall MSE. The resulting dataset is split into 80% training, 10% validation, and 10% test data. We min-max normalize all inputs and outputs of the neural network and use an architecture of seven linear layers. We choose a batch size of 32, the exponential learning rate scheduler with a starting learning rate of 10 <sup>_−_</sup> <sup>4</sup>, and a decay rate of 0 _._ 999. All layers, except the last layer, use the Mish activation function. As an optimizer, we use ADAM. These hyperparameters are selected through systematic trials. _3.2_ _Simulating_ _the_ _Real-World_ _Beamline_ Since testing on a real-world beamline is time-intensive, we test instead on another digital twin. By adding fixed but random offsets to all beamline parameters, this new digital twin imitates the fixed deviations of the real-world beamline from the digital twin. The offset finder’s task is to find offsets so that the footprints of the “real” beamline match those of the digital twin with the same configurations. A _configuration_ refers to a specific set of all beamline parameter positions. Various configurations must be scanned to find the offsets as accurately as possible. Since the real-world beamline is fully motorized, these configurations can be scanned automatically and quickly in the final real-world application. Table 1: Parameters and ranges for the RAY-UI simulations. Values are chosen randomly from a uniform distribution within the specified intervals. Parameters in italics are fixed but unknown. Component Parameter [Range] Undulator U41 ~~3~~ 18eV translation X, Y: [ _−_ 0 _._ 25 _,_ 0 _._ 25] mm, rotation X, Y: [ _−_ 0 _._ 05 _,_ 0 _._ 05] mrad Slit ASBL totalWidth: [1 _._ 9 _,_ 2 _._ 1] mm, totalHeight: [0 _._ 9 _,_ 1 _._ 1] mm, translation X, Y: [ _−_ 0 _._ 2 _,_ 0 _._ 2] mm Mirror M1 ~~C~~ ylinder _radius:_ [174 _._ 06 _,_ 174 _._ 36] mm, rotation X: [ _−_ 0 _._ 25 _,_ 0 _._ 25] mrad, Y, Z: [ _−_ 1 _,_ 1] mrad, translation X, Y: [ _−_ 1 _,_ 1] mm Spherical Grating _radius:_ [109741 _,_ 109841] mm, rotation Y: [ _−_ 1 _,_ 1] mrad, Z: [ _−_ 2 _._ 5 _,_ 2 _._ 5] mrad Exit Slit totalHeight: [0 _._ 009 _,_ 0 _._ 011] mm, translation Z: [ _−_ 150 _,_ 150] mm, rotation Z: [ _−_ 0 _._ 3 _,_ 0 _._ 3] mrad Mirror E1 _longHalfAxisA:_ [20600 _,_ 20900] mm, _shortHalfAxisB:_ [300 _._ 72 _,_ 304 _._ 72] mm, rotation X: [ _−_ 1 _._ 5 _,_ 1 _._ 5] mrad, Y: [ _−_ 7 _._ 5 _,_ 7 _._ 5] mrad, Z: [7 _,_ 14] mrad, translation Y, Z: [ _−_ 1 _,_ 1] mm Mirror E2 _longHalfAxisA:_ [4325 _,_ 4425] mm, _shortHalfAxisB:_ [96 _._ 16 _,_ 98 _._ 16] mm, rotation X: [ _−_ 0 _._ 5 _,_ 0 _._ 5] mrad, Y: [ _−_ 7 _._ 5 _,_ 7 _._ 5] mrad, Z: [22 _,_ 32] mrad, translation Y, Z: [ _−_ 1 _,_ 1] mm As previously mentioned, configurations with high ray counts are manually identified on the real-world beamline for meaningful results. To imitate this procedure, we use the surrogate model to search for random beamline configurations and add random offsets. We repeat this process until offsets are found for which the sum of the histogram values exceeds the value 0 _._ 5 for _n_ _>_ 15 beamline configurations, ensuring sufficient ray counts similar to those from the real-world beamline. As configuration candidates, 1000 real-valued vectors consisting of all beamline parameters are drawn uniformly distributed from the intervals as in Tab. 1. In the real-world beamline fixed but unknown parameters are chosen randomly but with the same values for all configurations. Furthermore, 100 real-valued offsets are drawn uniformly distributed with a maximum size of _±_ 20%—the maximum expected offsets derived from the experience of previously manually identified offsets—of the beamline parameter intervals. Both variables are chosen uniformly distributed to select them as unbiased as possible. The offsets are added to the configurations, evaluated with the surrogate model, and returned if their ray counts are sufficient. 34 Uncompensated Parameters 0 20 40 x histogram 1 … Experiment Footprint 34 Uncompensated Parameters 0.0075 simulation surrogate 0.0050 error 0.4 0.2 0.0 0.4 0.2 0.0 0.4 0.2 0.0 0.010 0.005 0.000 0.02 0.01 0.00 n … 0 20 40 y histogram 0.0050 0.0025 0.0000 Experiment Footprint Uncompensated Footprint Uncompensated Footprint Figure 3: Schematic view of _n_ configurations of the beamline components and its footprints. Figure 4: Three histograms of RAY-UI simulation (orange), surrogate model outputs (purple), and absolute error (red). _3.3_ _Offset_ _Finder_ In Fig. 3, we illustrate the set of _n_ beamline configurations with high ray counts from the simulated real-world beamline. The _experiment_ _footprints_ in orange represent the observed rays at the simulated real-world beamline. It is set up with _uncompensated_ _parameters_, represented by the positions of the blue knobs on the left. Simulating the uncompensated parameters in RAY-UI yields the _uncompensated_ _footprints_, depicted in blue on the right. The experiment and uncompensated footprints differ since the experiment footprints are generated with the uncompensated parameters deviated by the generated offsets. Parameters adjusted by the optimizer are called _compensated_ _parameters_, and their simulation in RAY-UI produces the corresponding _compensated_ _footprints_ . The target is to find offsets that shift the uncompensated parameters so that the compensated footprints match the experiment footprints precisely. To speed up optimization, the offset finder repeatedly uses the surrogate model instead of the digital twin to evaluate proposed offsets and compare the resulting histograms with those of the experiment footprints. The offset-finding algorithm, which we will refer to as _smart_ _walker_, works as follows: 1. Initialize a fixed amount of _m_ = 1 000 000 offsets with uniformly distributed random values, all below the maximum offsets of 20% as chosen in the simulated real-world beamline. This choice of _m_ maximizes the number of evaluated solutions while fitting within video memory. 2. Evaluate these offsets with all _n_ beamline configurations and take only the best solution. For evaluation, we add the offsets to the _n_ beamline configurations and evaluate these offset-adjusted configurations with the surrogate motel, choosing the best solution with the lowest MSE between the returned histogram by the surrogate model and the histograms of the observed experiment footprint. We calculate the MSE by averaging over the squared errors of all entries of the histograms. 3. Shift the best solution by an _m_ -dimensional, normally distributed vector with standard deviation step ~~w~~ idth = 0 _._ 002, which yields best results in our experiments. The offsets are clamped within their defined ranges. The maximum offsets are set to 20%, following our choice for the simulated real-world beamline. The shifted solution vector is the next vector of offsets to be evaluated. 4. Continue with step 2 until the maximum number of iterations is reached, which is chosen large enough, ensuring the error between the beamline and surrogate model output is sufficiently small. We compare our method with a Monte Carlo approach that tries random, uniformly distributed offsets within a maximum range of 20%, following our choice of the maximum simulated offset. We use the same number of attempted offsets per iteration for comparability as in the smart walker approach. 4 Results & Discussion Fig. 4 compares the surrogate model and simulation outputs using the same parameters, showing minimal differences and thus accurate estimations of the ray distributions. Since RAY-UI contains randomly sampled elements, e.g., the exact positions of the rays at the light source, its outputs vary slightly, even though the simulation is started with equal parameters. Thus, a completely perfect estimation is impossible. To compare the outputs of the surrogate model and the simulation, we calculated the overall MSE over all samples in the test set and the MSE of samples containing at least one ray. The overall MSE is calculated on the balanced dataset as described in Sec. 3.1. After 300 epochs, an overall MSE of 1 _._ 77 _×_ 10 <sup>_−_</sup> <sup>6</sup> and for the non-empty histograms an MSE of 2 _._ 16 _×_ 10 <sup>_−_</sup> <sup>6</sup> is reached. This result is expected since the samples with rays contain higher weighted values due to the MSE. Fig. 5 depicts the optimization curves of the two compared approaches. The smart walker reaches its optimum within 200 epochs and achieves an average MSEs of 3 _._ 87 _×_ 10 <sup>_−_</sup> <sup>6</sup> for the histograms of observed and compensated footprints over ten repeated runs, with a standard deviation of 6 _._ 34 _×_ 10 <sup>_−_</sup> <sup>7</sup> . The Monte Carlo approach plateaus early, with an optimum at 1 _._ 09 _×_ 10 <sup>_−_</sup> <sup>4</sup>, and its standard deviation is with 1 _._ 79 _×_ 10 <sup>_−_</sup> <sup>5</sup> higher and only slightly decreases. The smart walker approach takes, on average, 47.24 seconds on an Nvidia A100 for 200 million evaluations. By that, our approach is more scalable and efficient for beamline optimization, overcoming the dimensional and computational constraints of existing methods. Fig. 6 depicts the smart walker results after 1000 iterations, where the rows show the footprints using uncompensated parameters (top), uncompensated parameters with random offsets (middle), and compensated parameters (bottom). The observed and compensated footprints match almost perfectly, suggesting that the offset finding works, despite being limited to the surrogate model and the histograms of the footprints. The compensated parameters of the smart walker approach achieve an average Sinkhorn distance of all ray coordinates of 3 _._ 06 _×_ 10 <sup>_−_</sup> <sup>5</sup> compared to the reference with known offsets, while the Monte Carlo approach reaches 7 _._ 48 _×_ 10 <sup>_−_</sup> <sup>4</sup> . For reference, ten repeated runs with the digital twin of the known offsets differ by 2 _._ 03 _×_ 10 <sup>_−_</sup> <sup>6</sup> from the reference run due to simulation randomness. The normalized parameters the optimizer finds deviate with a Rooted Mean Squared Error (RMSE) of 0 _._ 58 from the pre-defined, randomly chosen normalized offsets. These high deviations occur because one component’s settings can counterbalance another component’s settings. For example, two mirrors on opposite sides can counterbalance their movements. 10 4 10 5 Smart Walker Monte Carlo 0 50 100 150 200 Iteration Figure 5: Mean (lines) and standard deviation (shaded) of optimization curves for the smart walker and Monte Carlo methods over ten runs. Figure 6: Simulated in Ray-UI: Uncompensated footprints (blue), experiment footprints (orange), compensated footprints (green). 5 Conclusion & Outlook We have trained a highly accurate surrogate model capable of identifying offsets for 34 beamline parameters, allowing us to find offsets up to _±_ 20% of the beamline parameter intervals. Since only some parameters can be adjusted, we determine and apply the offsets to the digital twin before optimizing beam properties like the smallest possible focus. We must consider _x_, _y_, and _z_ translation errors in the measurement chamber to apply this approach to a real-world beamline. With _z_ translation, we mean a shift in the direction of the beam perpendicular to the _xy_ plane. An extended surrogate model is needed for _z_ translation, while _x_ and _y_ translations can be reconstructed by shifting the histograms. Improving the optimizer through methods like simulated annealing or a weighted solutions population, as in evolutionary algorithms, is necessary to handle the increased problem dimensionality. We can also use gradient-based techniques like stochastic gradient descent for local search because the surrogate model is derivable. 6 Acknowledgments Support by the JointLab AIM-ED between Helmholtz-Zentrum f¨ur Materialien und Energie, Berlin, and the University of Kassel is gratefully acknowledged. We also acknowledge the valuable feedback from the co-authors, Kristina Dingel and Franz G¨otz-Hahn. References [1] A. Pietzsch et al. Inverted vls spectrometer at bessy for molecular potential energy surfaces and excitations. _Synchrotron_ _Radiation_ _News_, 31(2):20–25, 2018. [2] P. Baumg¨artel et al. RAY-UI: New features and extensions. _AIP_ _Conference_ _Proceedings_, 2054(1):060034, 01 2019. [3] S. Xi et al. Ai-bl1.0: a program for automatic on-line beamline optimization using the evolutionary algorithm. _Journal_ _of_ _Synchrotron_ _Radiation_, 24(1):367–373, 1 2017. [4] A. S. Karaca et al. Optimization of synchrotron radiation parameters using swarm intelligence and evolutionary algorithms. _Journal_ _of_ _Synchrotron_ _Radiation_, 31(2):420–429, 3 2024. [5] T. W. Morris et al. A general bayesian algorithm for the autonomous alignment of beamlines, 2024. [6] B. Nash et al. Combining diagnostics, modeling, and control systems for automated alignment of the tes beamline. _Journal_ _of_ _Physics:_ _Conference_ _Series_, 2380(1):012103, 12 2022.

섹션 본문 25문단 · 20,297자

(제목 없음)

1Beamline alignment is challenging as the beamline components must be set up ideally so that the rays follow the desired optical path.Automated methods using a digital twin allow for faster diagnostics and improved beam properties compared to manual tuning.We introduce an automated method of finding the offsets to improve this digital twin model.These offsets represent the unknown but constant differences between the beamline parameter positions as set up at the physical beamline and the corresponding parameter positions of its digital twin.Our method assumes the capability to execute precise relative movements with a known step size for these parameters, although the absolute position information is unknown.By combining the surrogate model with a global optimizer, we successfully determine offsets for 34 beamline parameters on a simulated METRIXS beamline at the BESSY II synchrotron radiation source in Berlin.

Introduction

2A synchrotron beamline consists of many components: mirrors, slits, gratings, crystals, and alignment units.Thus, many configurations must be tuned and optimized, which is time-consuming and requires expert knowledge.Because the beamline setup changes regularly, the beamline alignment must be carried out regularly up to daily.Thus, a one-click solution for automatically returning to the beamline's optimal state within minutes instead of hours of manual tuning is desirable.

3We need a digital twin, a virtual representation of a real-world beamline to provide such an approach.For this digital twin, we use a raytracing software that takes beamline configurations as input to calculate footprints-point clouds of ray coordinates at the end of the beamline.The beam transmitted through the beamline consists of many rays with slightly different coordinates and trajectories.The raytracing software simulates the trajectories of these rays from the light source through all optical elements to the end of the beamline.The measurements carried out using a focus measurement chamber at the real-world beamline correspond to the calculated footprints of the digital twin.However, discrepancies between the real-world beamline and the digital twin arise due to manufacturing inaccuracies.Additionally, alignments of the beamline components are in millimeter to micrometer scale, while a typical beamline is at the scale of tens of meters, prohibiting precise adjustments of these components in the real world.We call these differences, which are fixed for all configurations, offsets.Once the offsets are found, the digital twin-corrected by these offsets-can be used to optimize the beam properties to desired targets.This study presents a method to find automatically the offsets for various beamline parameters.To gather sufficient information about the current parameter offsets, we manually search for multiple parameter configurations with many rays visible on the measurement chamber screen.This procedure is essential since only such configurations are expressive for offset finding.If few or no rays reach the end of the beamline, this footprint could result from many parameter configurations and thus provides insufficient information gain.An overview of the offset finding process is given in Fig. 1.During the application phase, the offset finder suggests offsets, which are added to the previously determined beamline configurations with high ray counts.The configurations corrected by the proposed offsets must be simulated and compared with the footprints of the real-world beamline to evaluate the quality of the proposed offsets.Since the digital twin with 1-2 seconds evaluation time is too slow for this task, we replace it with a surrogate model, a fast simulation approximation.This surrogate model is trained once during the training phase and can be repeatedly used for the offset-finding process in the application phase.For the surrogate model, we train a neural network with a dataset that contains many randomly selected combinations of the investigated beamline parameters and their results from the digital twin.To further accelerate the training and evaluation of the neural networks, we map the beamline configurations not to the footprints but their x and y histograms, which are binned projections along the x and y axes, as shown in Fig. 2. The offset finder uses the surrogate model to evaluate quickly the beamline configurations corrected by different proposed offsets, compares them to the outputs of the real-world beamline, and quantifies the errors.The offset finder then uses these errors to suggest new offsets to be evaluated.This process is repeated until the error between the beamline and surrogate model outputs becomes sufficiently small.We demonstrate our approach on the Momentum and Energy resolved Resonant Inelastic X-ray scattering at molecular Systems (METRIXS) beamline at Berliner Elektronenspeicherring für Synchrotronstrahlung II (BESSY II) [1] and use the simulation tool RAY-UI [2] as a digital twin.As a proof of concept we test our approach not on the real-world beamline but on a beamline simulated with RAY-UI using imitated random offsets.This approach enables rapid testing with known offsets and prevents technical issues like unknown incorrect motor directions leading to wrong signed mirror alignments.

Related Work

4Since beamline optimization is a frequent task in all synchrotron radiation sources, numerous attempts are made to optimize automatically the beamline parameters.One approach is based on genetic algorithms [3].This approach is significantly restricted in the range of beamline parameter intervals and in the maximum amount of 15 optimized beamline parameters.Furthermore, only the parameters of two mirrors and one monochromator are optimized.Karaca et al. compare several optimization methods: genetic algorithms, non-dominated sorting genetic algorithm II, particle swarm optimization, and artificial bee colony [4].While particle swarm optimization achieves the best results in this study, its significance is limited, as only the focal distances of two mirrors are optimized.Another method that is applied is Bayesian optimization [5].These experiments are successfully applied for up to eight beamline parameters.Although the problem space is constrained, scaling Bayesian optimization to higher dimensions remains challenging due to its exponentially increasing computational complexity.

5In summary, existing beamline optimization approaches are constrained by the number of optimized beamline parameters or are restricted to narrow parameter intervals.These restrictions are required to limit the dimensionality and optimization problem space.All described approaches require parameter evaluations at the actual beamline, as no digital twin exists or offsets compensation is not applied to this digital twin.Determining fixed parameters like mirror radii or slope errors is impossible without matching a virtual twin to the real-world beamline.Furthermore, the possible evaluation number is limited, as realworld beamline evaluations take several seconds, rendering the process too slow for efficient optimization.

6We train a surrogate model similar to Nash et al. [6] to avoid this bottleneck.Because our surrogate model is a neural network, it is differentiable and, thus, allows the use of gradient-based optimizers.Neural networks also enable batch-wise evaluations on Graphics Processing Units (GPUs), allowing rapid processing of large numbers of evaluations.Due to these properties our offset finder can find global minima by evaluating millions of beamline parameters per second, using an optimizer similar to a random walker approach.In this study, we do not optimize the beamline parameters but focus on identifying the discrepancies between reality and simulation.Optimizing the beamline parameters based on these discrepancies is then straightforward, as it involves defining the desired target footprints and using the same optimizer as in the offset-finding process after adjusting the found offsets of the fixed parameters in the surrogate model.However, this aspect extends beyond the scope of the current work.

Surrogate Model

7We use a neural network for the surrogate model that replaces the computationally intense raytracing simulation tool, taking the beamline configurations as inputs and generating only the x and y histograms of the footprints, unlike the replaced simulation tool.To calculate the x and y histograms, we divide the intervals of possible values of x and y into k equally sized bins, counting how many rays are within the specified bin, as shown in Fig. 2. We use k = 50 bins for the x histograms over the interval [−10, 10] mm, and k = 50 bins for the y histograms over the interval [−3, 3] mm.These intervals cover the majority of rays while maintaining high positional accuracy.Unlike the simulation tool, the surrogate model is specific to the beamline and limited to the parameter ranges as defined in Tab. 1.

8We create a dataset with uniformly random sampled beamline parameters from Tab. 1 to train the neural network.These parameters are simulated using RAY-UI with 100 000 input rays, and their x and y histograms are stored in this dataset.We refer to each specific input constellation, as described in Tab. 1, combined with the RAY-UI simulation result, as a sample.We create a large dataset of 20 million samples, as approximately 95% of the beamline parameter combinations within our selected intervals result in a nearly empty footprint.We aim to ensure the dataset includes a sufficient number of samples-around 1 million-with footprints that contain enough rays for an effective training.The number of required samples could potentially be lower, so further investigation is needed to determine the optimal dataset size.From 80% of the dataset, we select samples containing at least one ray.From the remaining 20%, we select all samples including empty footprints.We apply this approach for faster dataloading and to speed up training because the dataset is very imbalanced, with samples containing rays being significantly rarer than those without rays.To further address data imbalance, we divide the data into "good" and "bad" groups of samples, where the former is comprised of almost 1 million samples containing at least ten rays, and the latter is comprised of those containing less.Samples are shown to the network with a ratio of 3:1 good to bad samples.A threshold below ten rays for this classification increases the Mean Squared Error (MSE) for non-empty histograms, while higher thresholds increase the overall MSE.The resulting dataset is split into 80% training, 10% validation, and 10% test data.We min-max normalize all inputs and outputs of the neural network and use an architecture of seven linear layers.We choose a batch size of 32, the exponential learning rate scheduler with a starting learning rate of 10 −4 , and a decay rate of 0.999.All layers, except the last layer, use the Mish activation function.As an optimizer, we use ADAM.These hyperparameters are selected through systematic trials.

Simulating the Real-World Beamline

9Since testing on a real-world beamline is time-intensive, we test instead on another digital twin.By adding fixed but random offsets to all beamline parameters, this new digital twin imitates the fixed deviations of the real-world beamline from the digital twin.The offset finder's task is to find offsets so that the footprints of the "real" beamline match those of the digital twin with the same configurations.A configuration refers to a specific set of all beamline parameter positions.Various configurations must be scanned to find the offsets as accurately as possible.Since the real-world beamline is fully motorized, these configurations can be scanned automatically and quickly in the final real-world application.As previously mentioned, configurations with high ray counts are manually identified on the real-world beamline for meaningful results.To imitate this procedure, we use the surrogate model to search for random beamline configurations and add random offsets.We repeat this process until offsets are found for which the sum of the histogram values exceeds the value 0.5 for n > 15 beamline configurations, ensuring sufficient ray counts similar to those from the real-world beamline.As configuration candidates, 1000 real-valued vectors consisting of all beamline parameters are drawn uniformly distributed from the intervals as in Tab. 1.In the real-world beamline fixed but unknown parameters are chosen randomly but with the same values for all configurations.Furthermore, 100 real-valued offsets are drawn uniformly distributed with a maximum size of ±20%-the maximum expected offsets derived from the experience of previously manually identified offsets-of the beamline parameter intervals.Both variables are chosen uniformly distributed to select them as unbiased as possible.The offsets are added to the configurations, evaluated with the surrogate model, and returned if their ray counts are sufficient.

Offset Finder

10In Fig. 3, we illustrate the set of n beamline configurations with high ray counts from the simulated real-world beamline.The experiment footprints in orange represent the observed rays at the simulated real-world beamline.It is set up with uncompensated parameters, represented by the positions of the blue knobs on the left.Simulating the uncompensated parameters in RAY-UI yields the uncompensated footprints, depicted in blue on the right.The experiment and uncompensated footprints differ since the experiment footprints are generated with the uncompensated parameters deviated by the generated offsets.Parameters adjusted by the optimizer are called compensated parameters, and their simulation in RAY-UI produces the corresponding compensated footprints.The target is to find offsets that shift the uncompensated parameters so that the compensated footprints match the experiment footprints precisely.To speed up optimization, the offset finder repeatedly uses the surrogate model instead of the digital twin to evaluate proposed offsets and compare the resulting histograms with those of the experiment footprints.

11The offset-finding algorithm, which we will refer to as smart walker, works as follows:

121. Initialize a fixed amount of m = 1 000 000 offsets with uniformly distributed random values, all below the maximum offsets of 20% as chosen in the simulated real-world beamline.This choice of m maximizes the number of evaluated solutions while fitting within video memory.

132. Evaluate these offsets with all n beamline configurations and take only the best solution.For evaluation, we add the offsets to the n beamline configurations and evaluate these offset-adjusted configurations with the surrogate motel, choosing the best solution with the lowest MSE between the returned histogram by the surrogate model and the histograms of the observed experiment footprint.We calculate the MSE by averaging over the squared errors of all entries of the histograms.

143. Shift the best solution by an m-dimensional, normally distributed vector with standard deviation step width = 0.002, which yields best results in our experiments.The offsets are clamped within their defined ranges.The maximum offsets are set to 20%, following our choice for the simulated real-world beamline.The shifted solution vector is the next vector of offsets to be evaluated.

154. Continue with step 2 until the maximum number of iterations is reached, which is chosen large enough, ensuring the error between the beamline and surrogate model output is sufficiently small.

16We compare our method with a Monte Carlo approach that tries random, uniformly distributed offsets within a maximum range of 20%, following our choice of the maximum simulated offset.We use the same number of attempted offsets per iteration for comparability as in the smart walker approach.

Results & Discussion

17Fig. 4 compares the surrogate model and simulation outputs using the same parameters, showing minimal differences and thus accurate estimations of the ray distributions.Since RAY-UI contains randomly sampled elements, e.g., the exact positions of the rays at the light source, its outputs vary slightly, even though the simulation is started with equal parameters.Thus, a completely perfect estimation is impossible.To compare the outputs of the surrogate model and the simulation, we calculated the overall MSE over all samples in the test set and the MSE of samples containing at least one ray.The overall MSE is calculated on the balanced dataset as described in Sec.3.1.After 300 epochs, an overall MSE of 1.77 × 10 −6 and for the non-empty histograms an MSE of 2.16 × 10 −6 is reached.This result is expected since the samples with rays contain higher weighted values due to the MSE.Fig. 5 depicts the optimization curves of the two compared approaches.The smart walker reaches its optimum within 200 epochs and achieves an average MSEs of 3.87 × 10 −6 for the histograms of observed and compensated footprints over ten repeated runs, with a standard deviation of 6.34 × 10 −7 .The Monte Carlo approach plateaus early, with an optimum at 1.09 × 10 −4 , and its standard deviation is with 1.79 × 10 −5 higher and only slightly decreases.The smart walker approach takes, on average, 47.24 seconds on an Nvidia A100 for 200 million evaluations.By that, our approach is more scalable and efficient for beamline optimization, overcoming the dimensional and computational constraints of existing methods.Fig. 6 depicts the smart walker results after 1000 iterations, where the rows show the footprints using uncompensated parameters (top), uncompensated parameters with random offsets (middle), and compensated parameters (bottom).The observed and compensated footprints match almost perfectly, suggesting that the offset finding works, despite being limited to the surrogate model and the histograms of the footprints.The compensated parameters of the smart walker approach achieve an average Sinkhorn distance of all ray coordinates of 3.06 × 10 −5 compared to the reference with known offsets, while the Monte Carlo approach reaches 7.48 × 10 −4 .For reference, ten repeated runs with the digital twin of the known offsets differ by 2.03 × 10 −6 from the reference run due to simulation randomness.

18The normalized parameters the optimizer finds deviate with a Rooted Mean Squared Error (RMSE) of 0.58 from the pre-defined, randomly chosen normalized offsets.These high deviations occur because one component's settings can counterbalance another component's settings.For example, two mirrors on opposite sides can counterbalance their movements.

Conclusion & Outlook

19We have trained a highly accurate surrogate model capable of identifying offsets for 34 beamline parameters, allowing us to find offsets up to ±20% of the beamline parameter intervals.Since only some parameters can be adjusted, we determine and apply the offsets to the digital twin before optimizing beam properties like the smallest possible focus.We must consider x, y, and z translation errors in the measurement chamber to apply this approach to a real-world beamline.With z translation, we mean a shift in the direction of the beam perpendicular to the xy plane.An extended surrogate model is needed for z translation, while x and y translations can be reconstructed by shifting the histograms.Improving the optimizer through methods like simulated annealing or a weighted solutions population, as in evolutionary algorithms, is necessary to handle the increased problem dimensionality.We can also use gradient-based techniques like stochastic gradient descent for local search because the surrogate model is derivable.

Figure 1 :Figure 2 :

20Figure 1: Architecture of our proposed approach.

Figure 3 :

21Figure 3: Schematic view of n configurations of the beamline components and its footprints.

Figure 4 :

22Figure 4: Three histograms of RAY-UI simulation (orange), surrogate model outputs (purple), and absolute error (red).

Figure 5 :

23Figure 5: Mean (lines) and standard deviation (shaded) of optimization curves for the smart walker and Monte Carlo methods over ten runs.

Figure 6 :

24Figure 6: Simulated in Ray-UI: Uncompensated footprints (blue), experiment footprints (orange), compensated footprints (green).

Table 1 :

25Parameters and ranges for the RAY-UI simulations.Values are chosen randomly from a uniform distribution within the specified intervals.Parameters in italics are fixed but unknown.

참고문헌 5건

  1. <i>AI-BL</i>1.0: a program for automatic on-line beamline optimization using the evolutionary algorithm Journal of Synchrotron Radiation · Wiley · 2016 10.1107/s1600577516018117
  2. Inverted VLS Spectrometer at BESSY for Molecular Potential Energy Surfaces and Excitations Synchrotron Radiation News · Taylor & Francis · 2018 10.1080/08940886.2018.1435952
  3. RAY-UI: New features and extensions AIP conference proceedings · American Institute of Physics · 2019 10.1063/1.5084665
  4. Combining diagnostics, modeling, and control systems for automated alignment of the TES beamline Journal of Physics Conference Series · IOP Publishing · 2022 10.1088/1742-6596/2380/1/012103
  5. Optimization of synchrotron radiation parameters using swarm intelligence and evolutionary algorithms Journal of Synchrotron Radiation · Wiley · 2024 10.1107/s1600577524000717