With increasingly tight beamline specifications, optical modeling software becomes necessary in order to design and predict the performances of conceptual beamlines. This becomes particularly true with the advent of highly coherent light sources (such the proposed upgrade of the ALS), where additional considerations such mirror deformation under heat load and effects of partial coherence needs to be studied. Luca Rebuffi will present the latest features of OASYS/Shadow, an optical beamline modeling tool widely used in the synchrotron community and show how to get started with beamline simulations.
https://github.com/awojdyla/ALS-U_ExamplesProgram:Monday February 26th, 2018: Introduction and discussions
(B2-400 all day) 2pm: ALS/CXRO Seminar | Luca Rebuffi (2-400)Tuesday February 27th, 2018:
9-11am (B15-300): Modeling ALS-U flagship beamline with OASYS
1-5pm (B2-200): Using SRW to create a source in OasysWednesday February 28th, 2018
9am-12pm (B6-1105): Tutorial on scripting with OASYS
1-5pm (B2-200): Tutorial on widgets with OASYSThursday March 1st, 2018: Tutorial on widgets with OASYS
9am-6pm (B2-200)Friday March 2nd, 2018: Advanced topics
Andrew McPhee (LLNL) – crystals
Widgets and parameter loopsMonday March 5th, 2018:
9am-12pm (B2-200) Tutorial on basic usage of Oasys
1-5pm: Publishing widgets on PyPI and distributing themTuesday March 6th, 2018
Visit of SLAC
Wednesday March 7th, 2018
Wrap-up and conclusion
Getting started with OASYS
Download it here: https://www.elettra.trieste.it/oasys.html
It works with Max and Linux; if you’re using a Windows PC, you will need to use a virtual machine.You can also try a web-based version of Shadow at sirepo.lbl.gov (it doesn’t have the same user interface, but most of the capabilities and a nice collaborative environment.)ShadowOui-Tutorial
Files for tutorial are available here:
https://github.com/srio/ShadowOui-Tutorial(clone and dowload> download zip > unzip on your computer and you’re good to goOR typegit clone https://github.com/srio/ShadowOui-Tutorial.git
in your terminal window)WARNING: It is recommended to download the FULL directory (in a zip for example). Downloading the individual *.ows files may not work (if doing that, click the “RAW” button in github before downloading).ShadowOui tutorial (pdf kindly provided by M. Sanchez del Rio, replete with python scripting and other nice tricks)
About Shadow, ShadowOui and OASYS
Shadow is a software developed for the optical simulation of beamlines. It features many options. It is a ray-tracing based simulation, and implicity assumes an incoherent beam, without diffraction effects (there are ways to incorporate these effects, see below.)
Some examples of beamline design
Canonical examples to come!
How to use Python
make sure you always import numpy
and Shadow
in your scripts:
import Shadow
import numpy as np
Then you can access the properties of in_object_1
, e.g. the first column
x = in_object_1._beam.getshonecol(1)
A proper documentation is still needed, here’s a description for the columns for earch ray:
Each ray is an array of 18 variables or columns. Each variable of column has an special physical meaning. The first six defines the geometry: spatial coordinates (Col. 1,2,3 or x, y and z, respectively) and the direction of the ray (cols. 4,5,6, or x’,y’ and z’, respectively). The rest of the columns defines the history of the ray traversing the optical system (electric vector for s-polarization (cols. 7,8,9) and p-polarization (cols. 16-18), flag for lost ray (10), wavelength (11)This is for accessing data within Oasys.Now if you want to play around more, here’s how to do so:src = Shadow.Source()
oe1 = Shadow.OE()
oe2 = Shadow.OE()
beam = Shadow.Beam()
In the case we want to read variables from existing files do:
src.load(“start.00”)
oe1.load(“start.01”)
oe2.load(“start.02”)
For applying to the beam the source: beam.genSource(src)
beam.traceOE(oe1)
beam.traceOE(oe2)
Write binary file:
beam.write('star.02')
Shadow.ShadowTools.plotxy(beam,1,3)
Shadow.ShadowTools.histo1(beam,1)
A few things to know:
- The coordinate system is always relative to the previous optical element (o.e)
- you can set the continuation plane at zero to get full control of the coordinates
Diffraction and Partial coherence
Use Wise & HYBRID
Other software and resources
The webpage of the SOS Workshop 2016 has many resources.
Software:- Sirepo
- SRW (Synchrotron Radiation Workshop; coherent, diffraction-based simulations)
- xrt (XRayTracer; it has a Shadow backend, and a comprehensive documentation)
- RayUI
- Virtual Lab – (proprietary, but can be used for modeling)
- spectra
Using Zemax is feasible, but not recommended
References and citation
- “Ray Tracing of X-Ray Optical Systems” by F. Cerrina and M. Sanchez del Rio in Handbook of Optics (volume V, 3rd edition, Ch 35), edited by M. Bass, Mc Graw Hill, New York, 2009. ISBN: 0071633138 / 9780071633130
- “SHADOW3: a new version of the synchrotron X-ray optics modelling package” by M. Sanchez del Rio, N. Canestrari, F. Jiang and F. Cerrina in J. Synchrotron Rad. (2011). 18, 708-716
- “A proposal for an open source graphical environment for simulating X-ray optics” by M. Sancez del Rio, L. Rebuffi, J. Demšar, N.Canestrari and O. Chubar in Proc. SPIE 9209, 92090X (2014)
- “DABAM: an open-source database of X-ray mirrors metrology” by M. Sanchez del Rio, D. Bianchi, D. Cocco, M. Glass, M. Idir, J. Metz, L. Raimondi, L. Rebuffi, R. Reininger, X. Shi, F. Siewert, S. Spielmann-Jaeggi, P. Takacs, M. Tomasset, T. Tonnessen, A. Vivo and V. Yashchuk in J. Synchrotron Rad. 23 (2016)
- “ShadowOui: A new visual environment for X-ray optics and synchrotron beamline simulations” by L. Rebuffi, M. Sanchez del Rio in J. Synchrotron Rad. 23 (2016)
- “OASYS (OrAnge SYnchrotron Suite): an open-source graphical environment for x-ray virtual xperiments” by L. Rebuffi, M. Sanchez del Rio in Proc. SPIE 10388, 103880S (2017) “Interoperability and complementarity of simulation tools for beamline design in the OASYS environment” by L. Rebuffi, M. Sanchez del Rio in Proc. SPIE 10388, 1038808 (2017)
Using Shadow/Oasys:
- “X-ray optics simulation and beamline design for the APS upgrade” by Shi, X., Reininger, R., Harder, R., & Haeffner, D. in Advances in Computational Methods for X-Ray Optics IV, 10388, 12 (2017)
- “Mutual optical intensity propagation through non-ideal mirrors” by Meng, X., Shi, X., Wang, Y., Reininger, R., Assoufid, L., & Tai, R. (2017). in Journal of Synchrotron Radiation, 24(5), 954–962 (2017) (2014).
- “A hybrid method for X-ray optics simulation: Combining geometric ray-tracing and wavefront propagation” by Shi, X., Reininger, R., Sanchez Del Rio, M., & Assoufid, L. in Journal of Synchrotron Radiation, 21(4), 669–678 (2014