BL1-4 Cheat Sheet

Last updated 30 April 2012

This is a guide to help you operate SAXS Beamline 1-4 a beamline primarily dedicated to the SAXS Materials Science technique.

Computer Control of Beamline 1-4MARCCD PC runs on a LINUX OS. MARCCD runs  the Mar (Rayonix) detector acquisition software, also called marccd (invoked with the command “marccd”). The Rayonix software is extremely unstable and bug-ridden and will crash even if simple interactions are attempted (e.g. inverting the intensity output display). Best to leave this PC well alone. The good news is that the functions that are necessary for data collection are all stable and can all be invoked remotely from BL14LX. MARCCD has been taken off the network so it is not perturbed by crosstalk. A crossover cable physically links MARCCD to BL14LX on a local network, with IP addresses 192.2.14.2 and 192.2.14.1 respectively.

BL14LX PC also runs on a LINUX OS. BL14LX governs all experimental control: the detector, the shutter, all sample motors and temperature control. The governing software is SPEC, an overlay of UNIX. To start SPEC right click on the background, select Open Terminal and invoke the command “spec” at the $ prompt. BL14LX has the IP address 192.1.14.10 on the broader network and 192.2.14.1 on the LAN with MARCCD.

GUEVARA PC runs on Windows XP. Its primary function is data reduction; essentially collapsing 2D images to 1D profiles; either radially or azimuthally for transmission SAXS data or using rectangular regions of interest for grazing-incidence SAXS data. The data reduction algorithms are macros compiled in the Image Pro Plus environment. The Image Pro Plus software has a desktop icon entitled “DATA REDUCTION.” The macros are located under the “Macro” dropdown and are generically tagged with TRSAXS for transmission data and GISAXS for grazing incidence data. They are preset to reduce TIFF images found in the folder C:\SAXS_Data\DATA_REDUCTION on GUEVARA.

Note:
• Stickers on the monitors indicate the necessary log-in protocols for each computer
• If you “quit” SPEC, then it’s important to manually close the other two windows that opened (info log and motor monitor) to avoid duplicate copies of them running and conflicting
• Whatever happens, avoid rebooting either BL14LX or MARCCD. (Why? Because LINUX has a terrible instability where devices can be reassigned to the wrong ports. So after a reboot, one can find that channels assigned to devices: shutters, motors, even the ethernet port to connect to the network, are reassigned and hence do not respond to their respective commands). At all times the most severe level of reset that should be applied is logging off either the BL14LX or MARCCD computers. If for some reason a reboot has occurred (e.g. power outage) then use the Crash Recovery Sequence below
• Although data reduction is best performed with Image Pro Plus, Winview32 is often a preferable environment for detailed visual scrutiny of a single image; this program has a desktop icon entitled either “Winview” or  “IMAGE ANALYSIS”
 

Crash Recovery Sequence

Only to be used in emergencies. Do not begin this sequence without checking with staff

1 On BL14LX: Quit SPEC (must type “quit” at the prompt) and close the two gnome terminal windows
2 Power off the MAR (Rayonix) detector (the power supply is the 1 metre cube black box outside the rear of the hutch. The switch is inside a door on the power supply)
3 Login to MARCCD PC
4 Hardware power on the MAR detector
5 On MARCCD: Start marccd software with command “marccd”
6 On MARCCD: Set to remote control mode from the dropdown marked “Acquire” and hit “Start”
7 On BL14LX: restart SPEC with command “spec” from the $ prompt

Why this sequence is important:
• If the detector is already powered on before logging in to MARCCD (i.e. if 4 comes before 3) then the marccd software will register a (gold) error screen saying the detector cannot be found
• If SPEC is already running before setting marccd software into Remote Acquisition mode (i.e. if 7 comes before 6) then MARCCD will refuse the SPEC connection request. This will generate the error message: “Connection refused from 192.1.14.11” (the IP address of MARCCD)



Library of useful SPEC commands for BL1-4

Data Acquisition Commands

sopen
Opens the shutter

sshut
Shuts the shutter

beamcheck
Opens the shutter for 0.1 seconds to determine whether there is sufficient beam present to take useful data. This command is useful to include in macros when running the beamline unmanned. If the beam is down, the macro will hang until the beam comes back up, when the macro will continue execution from the point it left off. If beamcheck determines that the beam is not present, it will re-check only every 5 minutes

icpst_in
Moves the post-sample ion chamber into the beam path in both x and y. The motors actually being driven are ic_ps_x & ic_ps_y and they move to preset (x,y) position (icpst_in_xpos, icpst_in_ypos)

icpst_out
Removes the post-sample ion chamber ~150 mm from the beam path in x. The motors actually being driven are ic_ps_x & ic_ps_y and they move to preset (x,y) position (icpst_out_xpos, icpst_out_ypos)

mar netroot mydirectory/mysample  [E.g. mar netroot PopleFeb12/AgBe_25C_60s]

Directs SPEC to store acquired images on the (remotely accessible) SPEC file server (specfs.slac.stanford.edu). This drive is visible from GUEVARA as the P: drive and the data will be directed to P:\bl1-4\mydirectory. The image will be tagged as mysample_0001.tiff and any further images will be tagged with the same name and iterating numbers. The data is also visible from the local W: drive – which is the hard drive of BL14LX, located at the bottom of rack 142. But the data is not actually on the W: drive, there is only one copy

Note:
• Directories need to be created on the Windows PC GUEVARA; permissions to create them from BL14LX have been disabled, since it would be possible to create directories with forbidden characters and so then the data would be stored but unretrievable (A separate backup of your data will be created manually on the HAL 9100 Terabyte drive (G:) which is sitting on the desk by the GUEVARA monitor)
• WARNING: It’s possible to overwrite your data with the mar netroot command, because each time the mar netroot command is invoked the file counter is reset to 0001. Ergo if you invoke the command twice with the same variables, data will start to be overwritten
• The (outdated) command mar fnroot mydirectory/mysample will direct the file to the local W: drive, but there is no advantage to this; the file is not visible from outside the lab and the disk space on W: is relatively limited
• To access the data on the P: drive from outside the lab, use secure ftp software (such as online freeware WinSCP) and connect to server specfs.slac.stanford.edu using the same login protocol as for BL14LX; i.e. Username SSRL\username and password
• In case the network drive is unavailable, mar netroot also switches automatically to an emergency protocol. Normally, when mar netroot is invoked it operates with a complex three step procedure: 1) saving data on MARCCD, 2) copying it to the network drive specfs (visible as drive P: on the Windows PC GUEVARA) and 3) deleting the local copy on MARCCD to avoid overfilling the local drive. In cases where the data cannot be written across the network for 10 seconds then the emergency protocol kicks in: the command will timeout and a SPEC alert flag will be set high. An error message will be generated informing the user that SPEC will be automatically switching to emergency data collection mode. In this mode the user may continue to use mar netroot identically as before, but now data will be written locally to the MARCCD hard drive and no attempt made to move it. Additionally, in this mode, each filename will be prefixed with the username and any sub-directory structure specified will (of necessity) be ignored. If and when problems are solved, then restarting SPEC (without logging out of BL14LX or rebooting) will clear the alert flag and mar netroot will operate as originally intended.  While operating in emergency mode the data will not be visible on the Windows-based PC GUEVARA.

mar bckgrd
This command loads the dark current image of the detector into a buffer within the detector head. All subsequent acquired images have this dark current pre-subtracted. This command should be run whenever there is a significant change in any experimental set-up, or after 24 hrs

mar collect 30
Acquires an image of 30 seconds exposure and saves it

mar reset
A recovery measure used to clear the status flags of the marccd detector. It has application in instances where ^C has been invoked at the SPEC prompt, either to break a running macro, or because a wrong single command was entered, e.g. mar collect x, where x was far too long. Entering ^C on BL14LX will successfully abort the SPEC command and return the SPEC prompt, *but* the marccd software can remain busy and unaddressable. In these cases mar reset from the SPEC prompt will restore the marccd software also. mar reset may also have application in other instances where the marccd software hangs (e.g. if the user unwisely chooses to interact with the marccd software directly)

General Motor Move commands

wm motorname
Abbreviation of "where motor": returns the current position, limit values, etc of motor motorname. The actual motor names are all listed in the multicoloured motor monitor panel; e.g. sp_horz; sp_vert; etc

wa
Abbreviation of "where all": Returns the current position, limit values, etc of all motors

mv motorname 25
Moves motor motorname to absolute position of 25 mm
umv motorname 25
u = update, so the position of motor motorname will be updated (directly below the cursor) as the move proceeds from the starting point to 25.00 mm
umvr motorname 2
r = relative; so the move of motor motorname will be 2 mm in the default positive direction from the starting point

smvr motorname 2
s = sleep; the relative motor move of 2 mm will begin after a delay of 5 seconds. Useful when working alone and needing to see a motor move

ascan motorname -1 1 40 0.1
This command will open the shutter and collect data for 40 intervals of 0.1 seconds, while motor motorname is stepped through 40 evenly spaced increments between -1 and 1. This command is very useful for sample alignment: two common applications would be locating the zero degree point on GISAXS samples on the goniometer head; or finding the multiple positions available in the multi-sample capillary holder. Note that this command has nothing to do with the MAR detector; the only “data” which is taken is the ion chamber values by which beam transmissions can be deduced. If the ascan command is being invoked for the first time at login, then it is first necessary to assign a filename with the command newfile filename


Temperature Control Commands

settemp 80
Sets the temperature of the stage to 80 °C and, in macro mode, immediately proceeds to execute the next command in sequence. In direct control mode it immediately returns the prompt

waituntiltemp 80
Sets the temperature of the stage to 80 °C and waits until the temperature is reached before either a) executing the next command in macro mode or b) returning the prompt in direct control mode

minovershoottemp 37.5
The oven was originally constructed for use around 150 °C to 300 °C and so when working at significantly lower temperatures, e.g. T < 50 °C, there is a certain amount of overshoot associated with the temperature ramping. In these cases this command has application; the function  minovershoottemp applies a crude PID on top of the PID fuzzy logic applied by the temperature controller. When the desired temperature, i.e. 37.5 °C in this example case, is exceeded by 0.1°C then the set temperature will be reset to 0°C (in order to guarantee that the heaters are shut off completely) to minimize the overshoot. When the temperature falls to 0.1°C below the desired setpoint, i.e. 37.4 °C, the set temperature is re-established at 37.5 °C and the prompt is returned to the user

showtemp
Returns the setpoint and current temperature on the BL14LX monitor

measuretemp
Loads the process variable of the temperature controller (i.e. the temperature) into a SPEC variable DEGC. Can verify this with the command p DEGC, which prints the DEGC value at the SPEC prompt on the BL14LX monitor. This has useful application when running macros


Setting up Macros to run the beamline automatically

Use the text editor with the command gedit from the $ prompt (outside of the SPEC environment) on BL14LX, i.e. gedit macroname.mac

Example macro for BL 1-4 automated data collection

def sequencename ’{
mar netroot directory/samplename
waituntiltemp newtemp1

for (i=0;i<numloops;i++){
measuretemp
mar collect exposetime
sleep(waittime)
}

waituntiltemp  newtemp2

for (i=0;i<numloops;i++){
measuretemp
mar collect exposetime
sleep(waittime)
}
}’

Note:
• Save the file as macroname.mac
• Compile (parse) the macro from the SPEC prompt with: qdo macroname.mac
Execute the macro from SPEC prompt with sequencename

 

Find Stanford Synchrotron Radiation Lightsource on TwitterFind Stanford Synchrotron Radiation Lightsource on YouTubeFind Stanford Synchrotron Radiation Lightsource on Flickr