1 of 24

Tutorial on Beamline Simulation: � Scripting with shadow4

“Francis” Wei He (francisho@lbl.gov)

Dr. Antoine İşlegen-Wojdyla (awojdyla@lbl.gov)

Bay Area Light Sources Joint Users' Meeting

Sep 20th, 2026

2 of 24

The Need for Scripting?

3 of 24

The Need for Scripting?

  • Less intuitive, but more flexible and better control

​

4 of 24

The Need for Scripting?

  • Less intuitive, but more flexible and better control
  • Implementable with Bluesky ecosystem
  • Transportable to digital twin

​

5 of 24

The Need for Scripting?

  • Less intuitive, but more flexible and better control
  • Implementable with Bluesky ecosystem
  • Transportable to digital twin
  • Enabling beamline automation

6 of 24

The Need for Scripting?

  • Less intuitive to human, but more flexible and better control
  • Implementable with Bluesky ecosystem
  • Transportable to digital twin
  • Enabling beamline automation

7 of 24

Models: Simplified from COSMIC-U

7

COSMIC-U (COherent Scattering and MICroscopy, Upgraded)

  • Diffraction-limited
  • E = 250 – 2,500 eV
  • Resolution power > 5,000

8 of 24

Models: Simplified from COSMIC-U

8

9 of 24

Models: Simplified from COSMIC-U

9

BL-1: GRE (Getting Rays Exported)

10 of 24

Models: Simplified from COSMIC-U

10

BL-1: GRE (Getting Rays Exported)

BL-2: LSAT (Looping Source, Auto-Tuning)

11 of 24

Models: Simplified from COSMIC-U

11

BL-1: GRE (Getting Rays Exported)

BL-2: LSAT (Looping Source, Auto-Tuning)

BL-3: MCAT (Metrology Complicating Actual Tracing)

12 of 24

To Start: Export from Oasys’ Widget

12

13 of 24

To Start: Export from Oasys’ Widget

13

14 of 24

To Start: Export from Oasys’ Widget

14

15 of 24

To Start: Export from Oasys’ Widget

15

16 of 24

Script Together

16

17 of 24

Script Together – git clone

17

18 of 24

Script Together – Google Colab

18

19 of 24

Script Together – Google Colab

19

20 of 24

Script Together

20

21 of 24

Acknowledgements

21

This work is supported by an Early Career Award in the X-Ray Instrumentation Program, in the Science User Facility Division of the Office of Basic Energy Sciences of the U.S. Department of Energy, under Contract No. DE-AC02-05CH11231. Wei He “Francis” is an ALS Doctoral Fellow supported by the Photon Science Development Group at the Advanced Light Source.

DREAM Team @ ALS

Antoine İşlegen-Wojdyla

Ka Hung Chan (Henry)

Hugo Calderon-Delgado

​

Computating Group @ ALS

Seij de Leon

Dylan McReynolds

Physics @ UC San Diego

Alex Frañó

X-ray Optics Program @ ALS

Kenneth A. Goldberg

Nicolás Smith

Ian Lacey

Valeriy Yashchuk

​

ALS 2.0

Maxime Bergeret

22 of 24

         �

Questions?

�

Questions?

23 of 24

Quantitative flux estimates

23

24 of 24

Positioning tolerances

24