Macros at XRF

A Macro is a series of instructions which are followed sequentially. You can use it to run different types of scan, moving from one sample to another.
Each macro needs two configuration files: (1) *.mac contains a set of instructions to move the motors; (2) *.ini containing the configuration parameters for each energy scan.

Templates for both the files are available in Desktop/macro (template_macro.mac and template_energy.ini).

Preparing the Macro

Keep in mind that the instructions are executed line by line.

A preview is available here, details are reported below:

Template_macro.mac

Template macro

Template_energy.ini
 

Template_energy.ini

[UniqueName]

Each measurement is identified by a [UniqueName] written in square brackets: the name used here will not be saved anywhere, it is only used by the computer to identify each section. Be sure to use unique names: if the same name is used twice, the computer will execute only the last one and the first will be forgotten. 


#Scan Type

Can be EXAFS (standard EXAFS/XANES), XSW (EXAFS at constant q), or XRR (reflectivity measurements)

#Manipulator

AxisX moves the manipulator motor X to the specified position. The names for the other motors are:

AxisY : Y
AxisZ : Z
AxisTheta : Theta
AxisTheta2 : 2Theta
AxisDiode : Diode
AxisDetector : Detector


When writing this part keep in mind that the movements are executed line by line. If the detector is close to your sample (< 50 mm), you should do all you can to keep the detector as far as possible during the moves, especially when moving from one sample to another (there might be screws taller than your samples!).

Moving from point A to point B? Consider this: high values of Z mean the sample is close to the detector.

If theta = 0: and Z_B < Z_A, this should be your first move as it is the safest! 
In this case the order can be:

AxisZ = Z_B
AxisX = X_B
AxisY = Y_B

#HOS

To move the Higher Order Suppressor mirror, you can use the following identifiers for each motors:
HosPitch, HosHor, HosVer


#ExitSlits

To move the exit slits, use the following identifiers:

CenterHOR, CenterVER, GapHOR, GapVER


#Detectors

Here are the details for the acquisition. One can activate one or more detectors, choose the BMS channel to be read, and set the acquisition time.
To activate a detector, set its value to True. The available detectors are Keithley (diode) or Bruker (fluorescence detector). 
Syntax:

AcquireKeithely = True | False
AcquireBruker = True | False

The AcquisitionTime must be set in seconds.
If you are not sure on which BMS channel you must use, ask the beamline staff.

#Energy

Here the details about the energy scan are specified. The ScanConfFile is a separate file carries the information about the start/stop energies, the edge energy and so on. If you have already run a scan, you will find an output_file.ini saved in the same folder as your files: you can use this one as a template.

For XSW scans, you can also change q, to do so, you can use the syntax:

 MomentumTransfer = 0.1

#Storage

Here one can set the folders and subfolders where the data is saved. Your data are available in the path: scratch4xrf/Investigation/Experiment/Dataset 

The file for each scan will be saved as RootFileName_yyyy-mm-dd_hh-mm.h5 and as a smaller .txt.
The txt version contains the crucial information for each scan, while many more details are enclosed in the h5 files.

In this section you can also set the NumberOfScan.

You can choose to skip single parameters or entire sections of the Macro. Be aware that any parameter which is not specified is left as it was in the previous scan (i.e. check the scan tool window!).


Running the Macro

Open the terminal (right click of the mouse and Open in Terminal) in the same folder where the file.mac is saved.
Then type:

macro ./nameofthemacro.mac 

(remember to add ./ before the name of the macro!)
To stop the macro (aborting the current acquisition) use CTRL+C in the terminal window.
 

Last Updated on Friday, 15 December 2023 11:23