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.



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 Oasys

Wednesday February 28th, 2018
9am-12pm (B6-1105): Tutorial on scripting with OASYS
1-5pm (B2-200): Tutorial on widgets with OASYS

Thursday 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 loops

Monday March 5th, 2018:
9am-12pm (B2-200) Tutorial on basic usage of Oasys
1-5pm: Publishing widgets on PyPI and distributing them

Tuesday 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.)


Files for tutorial are available here:


(clone and dowload> download zip > unzip on your computer and you’re good to go

OR type git 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:


For applying to the beam the source: beam.genSource(src)

For tracing the two optical elements:


Write binary file:


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.


Using Zemax is feasible, but not recommended

References and citation

Using Shadow/Oasys: