Open Access Presentation + Paper
16 September 2020 WISER wavefront propagation simulation code: advances and applications
M. Manfredda, A. Hafner, S. Gerusina, N. Mahne, A. Simoncig, M. Zangrando, L. Raimondi
Author Affiliations +
Abstract
In this work, we report the advances in the development of WISER. WISER is a wave optics-based simulation library targeted at the simulation of the focusing performance of grazing X-Ray optics systems, which accounts for the metrological data of figure error and roughness power spectral density. First presented in 2016 (phase-I), WISER inherits and expands the mathematical concepts of its ancestor, WISE, originally conceived for X-Ray telescopes and then applied to free electron lasers. Thanks to its flexible framework, WISER easily allowed to simulate multi-element systems, as synchrotron and free electron laser beamlines. In phase-II (2020), WISER is further improved and it is delivered as fully integrable with OASYS, the graphical canvas gathering the mostly used X-Ray computation tools. In the following, we will illustrate the architecture of the library and present some examples of its applications.
Conference Presentation

1.

INTRODUCTION

The impact of in-house developed codes is of increasing importance in today’s research, both for the capability of addressing specific problems and for the offered automation perspectives. However, often scientific codes, despite being a real mine of knowledge, are of scarce use for the community. Poor design, minimal generalization and cryptic shortcuts taken during the development process often limit their usability to few people, or to limited specific configurations. In addition, in most cases, a code is simply not thought so to be used by people other than the authors. Consequently, the gap-to-fill to make a collection of scripts evolving towards an organic ecosystem is often enormous, and it requires a combination of deep understanding of the physics and use of well-established programming paradigms. We decided to develop WISER to overcome these limitations: we started motivated by the previous outstanding experience of WISE [1,2], existing in a script-like form and already used to address challenging questions, with the aim of creating a totally new product, closer to a beamline design software. WISER’s main feature is modularity, made possible by the extensive use of object oriented programming and of design patterns. Modularity, in turn, enables a better maintainability and progressive extensibility: this means that, even with a limited set of initial features (for instance of optical elements), WISER can easily answer to user community needs arising in the future.

The reasons for developing WISER have been essentially three. First, the relevance of predicting the focusing performance of a hard X-ray mirror. Such a capability, which is at the basis of design, manufacturing and polishing of the optics of telescopes, synchrotrons and free electron lasers, is not reached by any other freely available computing tools (or not with the same accuracy); second, the need of a versatile set of “building blocks”, flexible enough to tackle potentially new scientific questions, and structured enough to be reusable; third, the recent development of OASYS[3,4], a working canvas whose aim is to gather all the most relevant software simulating X-ray beamlines and make them interact together. This is done by providing a simple modular graphic interface, which greatly propels the fruition and spread of the software and libraries contained in OASYS.

WISER is powered by three project libraries written in Python: LibWiser, which implements WISER entities (canvas, optical element, propagation engine, and more); WofryWiser, which adapts to WOFRY; and OasysWiser, which is the final implementation into OASYS. LibWiser enables to use WISER as standalone library, which requires extra-coding in Python, WofryWiser and OasysWiser enable to use WISER into OASYS, taking advantage of OASYS GUI. The lower layer (LibWiser) provides the total control of WISER, whereas the hi-level layer (OasysWiser) allows the use of the most common features.

The source codes are available online:[5,6,7]

After a brief summary of the underlying physical principles, we will briefly describe the outline of LibWiser, and show its architecture. The description of WofryWiser and OasysWiser is not included, although some screenshot of OASYS implementation are shown.

2.

PHYSICS

2.1

The Physical Basis

WISER is a wave propagation software, which enables to accurately simulate the electromagnetic field along a train of mirrors, accounting for the surface error metrology. WISER’s goal is precision rather than performance. The propagation of light is modeled with fully coherent monochromatic light within Kirchoff’s scalar diffraction theory, and the explicit evaluation of Huygens-Fresnel integral is carried out by recursive summation of complex exponentials (associated to spherical waves). Contrarily to many commonly used approaches in computational optics, FFT algorithm is not used. The attention devoted to metrology and the explicit summation of spherical waves are the main differences of WISER with respect to other well established – and more capillary – wavefront propagation software, such as SRW [8]. The surface error is modeled following the traditional classification of figure error and roughness: The first one is fed as a residual height profile with respect to the ideal curvature and the second one is fed as the Power Spectral Density of the surface height profile. Waive the use of the FFT makes computations longer, but it avoids the a-priori approximations which are necessary to make FFT-based propagators work when tilted planes are involved.

The integration is performed along the tangential (i.e. longitudinal) direction only. Such a choice is a consequence of the fact that, at the X-ray wavelengths, the mirrors are typically operated at grazing incidence, and sagittal scattering is negligible [1]. Each Optical Element (OE) is represented over a lD-support, which is described in a Cartesian space by a couple of arrays (xm, ym). Ultimately, real-world optical elements are represented by their longitudinal section: ellipsoidal or Kirkpatrick-Baez mirror are represented by elliptic arc sections, paraboloid mirrors by parabolic arc sections, plane mirrors and detectors by line segment, and so on.

The theoretical basis of WISER can be found in [1], where we find the expression of the field propagated from the optical starting element γ0 to the arrival element γ1, which is written as:

00001_PSISDG11493_114930B_page_2_1.jpg
00001_PSISDG11493_114930B_page_2_2.jpg

where λ is the wavelength, k= 2π/λ, L is the total length of the arrival element γ1, ϑ is the grazing angle comprised between the incident wave-vector 00001_PSISDG11493_114930B_page_2_3.jpg and the tangent at the mid-point if γ1, Rmk the distance between the points and E is the complex field. Both elements sampled with N points.

3.

ARCHITECTURE

WISER is written making extensive use of object oriented programming and design patterns with a manifold aims in mind: a) creating a flexible, modular code that can be progressively extended; b) giving the user a smooth, intuitive programming experience, also taking advantage of the auto-completion features of the modern IDE (Spyder, pyCharm); c) making the connection to OASYS simple and more natural.

The foundations of WISER are:

  • The BeamlineElements (Foundation.py) class

  • The OpticalElement (Foundation.py) class

  • The member of Optics class (Optics.py), which are often referred to as CoreOptics.

An inclusion relation holds between these entities: a BeamlineElements objects contain a collection of OpticalElementobjects, and every OpticalElement object contains a CoreOptics object. A sketch of WISER ecosystem is shown in Figure 1.

Figure 1.

Layout of the Optics object class. For each class, the representative members are shown only.

00001_PSISDG11493_114930B_page_3_1.jpg

3.1

BeamlineElements class

BeamlineElements represents a beamline. Its main roles are:

  • 1. To collect the OpticalElement objects in a tree structure, thus providing some of the most common functionalities (indexing, appending, deleting, getting sequence of items, etc)

  • 2. To act as mediator between the different optical element, handling:

    • a. the positioning of the OpticalElement objects on the canvas (see)

    • b. the field propagation.

As side note, the fact that BeamlineElements behaves like a tree structure, thus accepting nodes and forks, has been originally conceived for handling with devices such as split-and-delay line or spectrometers. However, presently such a functionality is not fully implemented yet.

3.2

OpticalElement class

OpticalElement is as an empty container whose tasks are:

  • 1. Storing the positioning command in the PositioningDirective object

  • 2. Storing the information about siblings (parent, child/children), the computed data and the computation settings

  • 3. Storing the complex CoreOptics subsystem and implementing a facade pattern, to provide just the functionalities that are really needed in the BeamlineElement ecosystem.

A diagram of the OpticalElement class is shown in Figure 2.

Figure 2

Diagram of the OpticalElement class.

00001_PSISDG11493_114930B_page_4_1.jpg

3.3

Optics and CoreOptics

The Optics classes provide the true implementation of the real-world optical elements. In particular, the ultimate implementation is carried out by a subset of the Optics classes, which is informally called CoreOptics.

Eventually, the instances of a CoreOptics object are:

  • 1. containing the specific code, which defines object behavior, namely how the coordinates within the canvas, the incident and the emerging vector are computed;

  • 2. storing the specific parameters of the object to be created (e.g. the wavelength for a light source, or the incidence angle for a mirror, etc.);

  • 3. storing the metrology information (figure error and roughness);

  • 4. storing low-level computation settings;

  • 5. providing, among the others, the following milestone attributes:

    • a. GetXY (to get the x,y coordinates of the CoreOptics object),

    • b. EvalField(x,y, …) to propagate the field from the present optical element to the coordinates (x,y),

    • c. RayInNominal, RayOutNominal, i.e. the vectors (represented in WISER class) associated to incident and emerging scattering wave vector,

A layout of the class hierarchy is shown in Figure 3. The classes Optics, OpticsNumerical, OpticsAnalytical and Mirror acts as abstract blueprint for the “concrete” objects SourceAnalytical, MirrorElliptic, MirrorSpherical, MirrorPlane, Slit, Detector, etc. For these reason, the formers are marked as “<<abstract>>”, understanding that they can not be initialized as standalone objects. The complexity of the CoreOptics classes depend on the optical element itself. For instance, the set of additional formulas required for handling the elliptic mirror are more involved than the ones required for plane mirrors. However, the autonomy of CoreOptics objects is rather limited, as the parent classes already implement the most challenging task: the positioning and rotation algorithms, and the propagation. For this reason, adding a new CoreOptics object is a straightforward operation end requires little or no maintenance to the main code.

Figure 3

Diagram of the Optics object class. For each class, only the representative members are show.

00001_PSISDG11493_114930B_page_6_1.jpg

4.

EXAMPLE

A more thorough documentation of WISER, with examples, will be available online on the GIT repository [5]. Here we are just interested in presenting the general appearance of a client code that uses Lib Wiser. We will consider a simple example of a beamline composed by a FEL-like source, a plane mirror, a focusing ellipsoidal mirror and a detector. Parameters can be found in the code.

00001_PSISDG11493_114930B_page_7_1.jpg00001_PSISDG11493_114930B_page_8_1.jpg

Units are expessed in S.I. and angles are in radians. After instantiating the CoreOptics objects s, pm, kb, Detector, the BeamlineElements object can be instantiated and populated as well:

00001_PSISDG11493_114930B_page_8_2.jpg

The command Beamline.RefreshPositions() gives the instruction to traverse the chain of OpticaElement objects and physically assign the XYCentre attribute to each item. After the beamline is refreshed, it is possible to check the internal representation of WISER,by means of:

00001_PSISDG11493_114930B_page_8_3.jpg00001_PSISDG11493_114930B_page_9_1.jpg

The command iterates across the optical elements of Beamline and for each optical element displays its name (marked by double “*”), the name of its parent (to the left), the name of its first child (to the right). “DeltaZ” is the distance from the previous optical element, and “Z” is the cumulative distance from the source.

Another option for checking the internal representation of WISER is the Beamline.Paint() command, which produces a simplified sketch of the optical elements in the WISER canvas. Such a tool is just intended for debug purpose, and shall not be used for producing publication level graphics.

00001_PSISDG11493_114930B_page_9_2.jpg

Figure 4

Example of the output of the .PaintQ command.

00001_PSISDG11493_114930B_page_9_3.jpg

Finally, the field can be computed onto all the optical elements by means of the ComputeField command.

00001_PSISDG11493_114930B_page_9_4.jpg

For each optical element, the results are stored in

00001_PSISDG11493_114930B_page_9_5.jpg

which has the following attributes:

  • Field: the complex field,

  • Intensity: the squared modulus of the field,

  • Lambda: the wavelength used,

  • Hew: the Half Energy Width computed on the intensity

  • NSamples: the number of samples used

  • Name: a clone of the name of the optical element

  • X,Y: the coordinates of the optical element (more precisely, of its CoreObject member)

  • S: the longitudinal coordinate that runs along the optical element (used in plots).

The intensity at the detector can be displayed by means of:

00001_PSISDG11493_114930B_page_9_6.jpg

Figure 5

Example of the intensity computed at the nominal focal plane, with ideal mirror curvature.

00001_PSISDG11493_114930B_page_10_1.jpg

The following code shows how to add a figure error to the surface profile of the optical element:

Figure 6

Example of intensity computed at the nominal focal plane, with non-ideal mirror curvature.

00001_PSISDG11493_114930B_page_10_2.jpg

In the example shown, the field is computed at the nominal position of the detector. There may be a wide number of reasons, however, for which the true focal plane is shifted from its nominal position. Possible causes can be: the Gaussian nature of the source, the figure error itself, or the combination of the two [9]. WISER has dedicated functions to find the best focal spot by minimizing the spot size while performing a through-focus scan, which is already integrated in OASYS, as it is shown in Figure 7. In addition, it can be adapted to more sophisticate investigations which involve parametric scans. This make it an ideal tool for optical system performance analysis [10].

Figure 7

Screenshot of the “detector” widget in OASYS, which enables to find the best focus by minimizing the HEW. In the example considered, the best-focus is 5.7mm upstream with respect to the nominal focus. Simulation is performed at λ= 4nm. For the other parameters see Figure 8.

00001_PSISDG11493_114930B_page_11_1.jpg

Figure 8

Example of some parametric scan which can be performed with WISER. The parameter is the source wavelength. a) dependence of the spot size as function of the wavelength; b) dependence of the focal shift as function of the wavelength; c) sketch of the conceptual layout; d) figure error used. The computation is performed with a Gaussian source (waist size=150 μm, M2 = 1) illuminating an elliptic mirror (f1 = 88.5 m, f2= 1.2 m, υi = 2°).

00001_PSISDG11493_114930B_page_11_2.jpg

As an example, in Figure [],we display the parametric plot of the spot size (computed as the Half Energy Width) and of the focal shift as function of the wavelength for an ellipsoidal mirror illuminated by a Gaussian source.

Some of these functionalities are directly available into OASYS.

5.

CONCLUSIONS

WISER has been released both as stand-alone library and as add-on to OASYS. The development is far for being concluded. New optical elements will be implemented, such as gratings and monochromators, as well as new kind of sources, in order to better match the need of the X-ray optics community. Examples and updates will be soon available on the web [5], [11].

6.

CREDITS

We thanks Luca Rebuffi for his dedicate support and advise on software design, Daniele Cocco for believing in WISER potentials and providing useful hints for improvement, and Daniele Spiga for the perseverance and knowledge he put in making the first version of WISE rise.

A.H. and this open access publication have received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No. 823852 (Panosc).

REFERENCES

[1] 

L. Raimondi and D. Spiga, “Mirrors for X-ray telescopes: Fresnel diffraction-based computation of point spread functions from metrology,” Astron. Astrophys., 573 A22 (2015). https://doi.org/10.1051/0004-6361/201424907 Google Scholar

[2] 

L. Raimondi, “Microfocusing of the FERMI@Elettra FEL beam with a K-B active optics system: Spot size predictions by application of the WISE code,” Nucl. Instruments Methods Phys. Res. Sect. A Accel., Google Scholar

[3] 

L. Rebuffi and M. Sanchez del Rio, “OASYS (OrAnge SYnchrotron Suite): an open-source graphical environment for x-ray virtual experiments,” 28 (2017). Google Scholar

[4] 

L. Rebuffi and M. Sanchez del Rio, “Interoperability and complementarity of simulation tools for beamline design in the OASYS environment,” 8 (2017). Google Scholar

[5] 

M.Manfredda, A. Hafner, L. Raimondi, “WISER, the wave propagation simulation code, reloaded,” , Google Scholar

[6] 

A. Hafner, M. Manfredda., L. Rebuffi, “OasysWiser,” Google Scholar

[7] 

A. Hafner, M. Manfredda, L. Rebuffi, “WofryWiser,” Google Scholar

[8] 

O. Chubar, P. Elleaume, “Accurate And Efficient Computation Of Synchrotron Radiation In The Near Field Region,” in proc. of the EPAC98 Conference, p.1177 –1179 (1998). Google Scholar

[9] 

M. Manfredda, L. Raimondi, N. Mahne, and M. Zangrando, “Focal shift induced by source displacements and optical figure errors,” J. Synchrotron Radiat., 26 1503 –1513 (2019). https://doi.org/10.1107/S1600577519010099 Google Scholar

[10] 

L. Raimondi, “Kirkpatrick-Baez active optics system at FERMI: System performance analysis,” Spectrometers, Detect. Assoc. Equip., 710 131 –138 (2013). https://doi.org/10.1016/j.nima.2012.11.039 Google Scholar

[11] 

© (2020) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
M. Manfredda, A. Hafner, S. Gerusina, N. Mahne, A. Simoncig, M. Zangrando, and L. Raimondi "WISER wavefront propagation simulation code: advances and applications", Proc. SPIE 11493, Advances in Computational Methods for X-Ray Optics V, 114930B (16 September 2020); https://doi.org/10.1117/12.2568574
Advertisement
Advertisement
KEYWORDS
Wavefronts

X-rays

Metrology

Optical components

Optical simulations

Wave propagation

X-ray optics

Back to Top