11. Beamline automation#
Caution
Spreadsheets with version number earlier than 13 will not work as of 1 March, 2024.
BMM currently supports five categories of spreadsheet-based automation:
Sample wheels (spreadsheet)
Linkam stage temperature control (spreadsheet)
LakeShore 331 controller for Displex cryostat (spreadsheet)
Glancing angle stage (spreadsheet)
Generic XY and XYZ grids (spreadsheet)
The latest spreadsheets for each of these can always be found at NSLS-II-BMM/profile_collection
Each of the spreadsheets looks much like this, although there are some differences in the columns corresponding to the different instruments.
Make sure you are using the most up-to-date version of the spreadsheet.
Note
The current spreadsheet version is 14, as of 14 November, 2024. You should always use a current spreadsheet.
Caution
Spreadsheets with version number earlier 13 will not work as of 1 March, 2024.
11.1. Common features#
11.1.1. Default information#
All the spreadsheets use the concept of “default” scan information, that is, information that is expected to be used for most or all of the indicated measurements. In Figure 11.1, the defults are entered into the row with the green background. All rows underneath the green line are used to describe individual measurements.
For each individual measurement:
If a white cell is left blank, the default value from the corresponding green cell will be used.
If a white cell is filled in, that value will be used for that measurement.
11.1.2. Experimenters#
Note
As of summer 2024, with the implementation of data security, the beamline now has access to some information about the proposal and SAF. It is no longer necessary to specify the names of the experimenters. All names on the proposal will be put in the metadata of every scan.
11.1.3. Measurement options#
Beneath the experimenter cell, there are three drop-down menus for setting aspects of the sequence of measurements described on the spreadsheet tab.
A yes/no menu for telling Bluesky to close the shutter at the end of the measurement sequence.
A menu of options for modifying filenames to contain information about things like absorber element, edge symbol, Linkam stage temperature, and so on. This simplifies data entry into the
filename
column of the spreadsheet.A place for specifying the number of repetitions of the entire spreadsheet. This is different from the column labeled “repetitions”, which specifies the number of repeated XAS scans of the sample in that row of the spreadsheet.
11.1.4. Detector position#
On the right hand side of each spreadsheet, there is a column for specifying the position of the fluorescence detector. A smaller value is closer to the sample.
The detector position is set on a sample-by-sample basis, allowing the best possible measurement – not saturating the detector while maximizing the signal for samples of different absorber concentrations – for each sample. For many experiments, most of the set up work involves moving from sample to sample and setting the values of this column.
11.1.5. Fine tuning sample position and slits#
On the right hand side of each spreadsheet, there are columns for specifying specific positions for sample X and Y and for slit width and height. This allows you to fine tune the sample position and beam size on a per-sample basis.
The motor grid spreadsheet offers three columns for specifying motor positions. The motors associated with those columns are user-select-able. In this way, a grid over any beamline motor can programmed.
The glancing angle spreadsheet has the columns for specifying slit width and height. It also has columns for specifying sample Y and pitch (X and pitch when in perpendicular mode) when manual alignment rather than automated alignment is selected. There is no column for specifying the X position (or Y when in perpendicular mode) as use of the glancing angle stage presumes that all the samples are mounted at the centers of the spinners.
11.2. Selecting a spreadsheet#
All spreadsheets are imported using the xlsx()
command. The
spreadsheets are self-identifying. Every spreadsheet has an
identifying string spanning cells B1:C1. This is the cell with the
pink background.
Caution
Never change the text in the pink cell or your spreadsheet will likely be interpreted incorrectly.
11.2.1. Import a spreadsheet#
To convert a spreadsheet into a macro then run the macro, do the following:
xlsx()
This will show a numbered list of all .xlsx
files in your data
folder, something like this:
Select your xlsx file:
1: 20210127-KB1.xlsx
2: 20210127-KB3.xlsx
3: 20210128-KB2.xlsx
4: 20210128-KB4.xlsx
5: 20210128-KB5.xlsx
6: wheel_template.xlsx
r: return
Select a file >
Select the .xlsx
file you want to import. Based on the
content of the pink identifying cell, your spreadsheet will be
interpreted appropriately.
You may have multiple tabs in the spreadsheet file. If the file you selected from the menu shown above has multiple tabs, you will be presented with a menu of tabs, something like this:
Select a sheet from yourfile.xlsx:
1: tab1
2: tab2
3: tab3
r: return
Select a file >
Enter the number corresponding to the tab to be measured.
The menu of tab selections will only be presented if there is more than one tab in the spreadsheet file.
You may organize your experiment in a single file with multiple tabs or in multiple files (each with one or more tabs). That is enturely up to you.
11.2.2. Generating Bluesky instructions#
The tab on the selected spreadsheet file will be parsed, then a macro
file generated called <tab>_macro.py
and an INI file called
<tab>.ini
, where <tab>
is the name of the tab from
which the instructions were read.
It is, therefor, a very good idea to give your tabs names that indicate something about the experiment being described on that tab.
The INI file (Section 9.1) contains the default values
from the green line (see Figure 11.1).
The macro file is imported into the BlueSky session, providing a new
with the name of the spreadsheet file. If the tab in the spreadsheet
was called mysamples
, the new BlueSky command is called
mysamples_macro()
.
Future Tech!
Convert spreadsheets to Bluesky queueserver input.
11.3. Sample wheel automation#
The standard ex situ sample holder at BMM is a plastic wheel mounted on a rotation stage. Examples are shown in figures Fig. 11.2. The rotation stage is mounted on an XY stage, so when one slot on the sample wheel is aligned, all the slots are aligned.
The automation concept is that a measurement at an edge on a slot on the sample wheel is described by a row in the spreadsheet. Each column of the spreadsheet carries one parameter of the XAFS scan.
If you have read Section 9.1 about the INI file, then most of the columns in this spreadsheet will be quite familiar. Most of the columns are used to specify the same set of parameters as in the INI file – file name, element, edge, and so on.
The green cell in the first row is used to input the names of all the people involved in the experiment, as explained above.
As explained above, row 6, the row with the lime-green background, is used to specify the default values for all the parameters. The concept here is to try to avoid having to input repetitive information. For instance, in this case, all measurements will be made at the Fe K edge. The element and edge are all specified in the green row. Those cells are left blank for all subsequent rows, so the default values will be used.
In short, any cell that is left blank will use the value from the green, default row. Any cell for which a value is specified will be used in the macro that gets generated.
The first column is used to specify the slot number for each sample on the sample wheel.
The second column is a simple way of excluding the slot from measurement simply by specifying No.
The next several columns correspond to lines in the INI file as explained in Section 9.1.
Energy changes can be included in the macro by specifying different
values for element and/or edge in a row. When specified
and different from the previous row, a call to the change_edge()
command (Section 7) is inserted into the macro.
Not shown in Figure 11.1 are columns
for tweaking the xafs_x
and xafs_y
positions, adjusting the
horizontal and vertical size of slits3 (see Section 7.6), and adjusting the fluorescence detector position.
Again, assuming the tab in the spreadsheet was called mysamples
,
you can then run the macro generated from the spreadsheet by:
RE(mysamples_macro())
Here are the first few lines of the macro generated from this
spreadsheet. Note that for each sample, the macro first moves using
the slot()
command, then measures XAS using the xafs()
command. The xafs()
command uses the INI file (Section
9.1) generated from the green default line and has
explicit arguments for the filled-in spreadsheet cells.
1yield from slot(1)
2yield from xafs('MnFewheel.ini', filename='Fe-Rhodonite', sample='MnSiO3', comment='ID:93 Russia')
3close_last_plot()
4
5yield from slot(2)
6yield from xafs('MnFewheel.ini', filename='Fe-Johannsonite', sample='CaMnSi2O6 - LT', comment='B –Iron Cap Mine; Graham Country, Arizona')
7close_last_plot()
8
9yield from slot(3)
10yield from xafs('MnFewheel.ini', filename='Fe-Spessartine', sample='Mn3Al2(SiO4)3', comment='Grants Mining District; New Mexico')
11close_last_plot()
12
13## and so on....
11.4. Linkam stage automation#
One of the temperature control options at BMM is a Linkam stage. Ours is the kind that can cool using liquid nitrogen flow or heat up to 600 C using a resistive heater. The linkam stage is typically mounted upright on top fo the XY stage.
The automation concept for the Linkam stage is quite similar to the ex situ sample holder. Instead of specifying the slot position of the sample, you will specify the target temperature for the measurement. There is also a column for specifying the holding time after arriving at temperature before beginning the XAFS measurement.
The feature described in Section 11.1.3 for modifying filenames is particularly useful in this context. It can be used to put the measurement temperature in the filename, allowing you to simply specify a default filename, leaving that cell in each row blank. The generated data files will then have sensible names.
11.5. LakeShore/Displex automation#
For extremely low temperature experiments, BMM has a Displex crystat which uses a two-stage helium compressor to cool the cold head down as low as 10K with temperature control between 10K and 500K using a resistive heater and a LakeShore temperature controller.
This is a somewhat unusual version of the Displex system in that it is suitable for low-vibration applications. The compressor is mechanically decoupled from the cold head, reducing the motion of the sample. As a result of this cooling system, it is somewhat time-consuming to temperature cycle and replace samples. Expect that cooling from room temperature to 10K will take about 2 hours and budget up to an an hour for returning to room temperature and changing samples.
The automation for the LakeShore 331 works much the same as for the Linkam stage. Again, you will specify the target temperature for the measurement. And there is a column for specifying the holding time after arriving at temperature before beginning the XAFS measurement.
There is a column for specifying the power level of the heater in the cryostat. There are three power settings. You probably want to use the high power setting. The controller is pretty well tuned for the cryostat. It is unlikely to overshoot the when raising temperature.
11.6. Glancing angle stage automation#
This stage is used to automate measurement at glancing angle, usually on thin film samples. The stage can be mounted horizontally or vertically, allowing measurement of in- or out-of-plane strain in thin films.
This stage is mounted on a rotation stage to move between samples. The rotation stage is mounted on a tilt stage to set the incident angle of the beam relative to the sample surface. This entire set up is mounted on the XY stage for alignment on the beam.
Each sample is affixed to a sample spinner (which is simply a cheap, 24 VDC CPU fan). The 8 spinners are independently controlled via slip ring electrical connection that runs through the axis of the rotation stage. In practice, only the sample that is being measured is spinning.
Again, the automation concept is very similar to the ex situ sample wheel. Instead of specifying slot number, the spinner number is specified on each row. There is also a yes/no menu for specifying whether the sample spins during measurement.
Not shown in Figure 11.9 are columns for specifying how sample alignment is handled. The default is to do automated alignment. This works by following this script:
Move the stage to an incident angle that is close to flat for the sample and start the sample spinning.
Do a scan in the vertical direction, measuring the signal in the transmission chamber. Fit an error function to the transmission signal. The centroid of that function is the position with the sample half-way in the beam.
Do a scan in pitch, measuring the signal in the transmission chamber. The peak of that measurement is the position where the sample is flat relative to the beam direction.
Repeat steps 2 and 3.
Move the sample tilt to the angle specified by the user in the spreadsheet.
Do a scan in the vertical direction, measuring the signal in the fluorescence detector. The center of mass of that measurement is the position where the beam is well-centered on the sample.
The result of this fully automated sequence is shown in Figure 11.10.
For some samples, the automated alignment is unreliable, so there is
an option in the spreadsheet for manual alignment. In that case, find
the xafs_y
and xafs_pitch
positions for the sample at its
measurement angle and well-aligned in the beam. Enter those numbers
and they will be used by the macro rather than performing the
automated alignment.
11.7. Motor grid automation#
The final kind of automation-via-spreadsheet available is BMM is for a
generic motor grid. The most common motor grid used for measurement
is the sample XY stage, xafs_x
and xafs_y
. However, any two
motors on the beamline can be used for the grid.
There are columns (to the left of the view shown in Figure 11.11) for specifying the axes in the grid.
In all other ways – except for the slot
column – this
spreadsheet is identical to the ex situ sample wheel spreadsheet.
Future Tech!
Spreadsheets for:
Electrochemistry experiments using the BioLogic potentiostat
Chemistry experiments using the gas cart, including its mass flow controllers, valves, temperature controller, and mass spectrometer.
Caution
Spreadsheets with version number earlier than 13 will not work as of 1 March, 2024.