All macros are stored in /gpfs/local/beamline/ixs_macros/

Unless stated otherwise, all macros are written with python

In order to run, open a terminal window and simply execute the following command

python <name of the python file>

Example: $python

Important macros for smooth energy scanning:

These macros should be started before energy scanning and be running in the background. (outdated 11.2017)

It tweaks the piezo of the second crystal to move the beam to zero position on the BPM, which located at the end of EH1. The frequency of the correction is a few Hz.


BPM in EH1 should be aligned and the CAEN current amplifier should be running (Device: p01/caenelsah501d/exp.01) The macro will push the beam to "zero" position on the BPM, so if the beam is not at this position when everything is optimized and aligned, the beam is going to move. The step by step procedure:

  1. Make sure the voltage on the piezo is zero. Device: p01/piezopie816/mono1.01 & Attribute: Voltage
  2. Align everything to the desired state. (particularly the undulators and DCM_pitch)
  3. Run the macro to observe where the beam is on the BPM
  4. Unless the Y-pos is not within +/- 0.1 unit, the feedback is going to move the beam dramatically, and the intensity is going to be partially lost. So move eh1_bpm_y position untill the Y-pos value is as close to "zero" as possible. The eh1-bpm_y is in milimeters.

Keep in mind, if there is more optics downstream that are aligned based on the previous zero value and now the move is more than a few hundred micron, the alignment for downstream might be off after this step. Another way to go around this is to move the beam instead of the BPM. For that ask for assistance. 5. Now, you can run the macro


It tweaks the undulator to follow the DCM energy.

prerequisites: The undulator offset value should be adjusted such that the undulator energy and the DCM energy correspond. Every couple hundred miliseconds it checks the energy of the DCM and moves the undulator gap to track the energy. On the terminal it runs, the time of each movement is recorded.

At about 10100eV (10200eV) gap_a (gap_b) change from 3rd to 5th harmonic if the "setHarmonicAutomatically" boxes in the undulators Atk panel are checked -> Consider unchecking them.


  • No labels