SerialEM HowTo: Drift Control

Chen Xu

$BrandeisEM: ~emdoc-xml/en_US.ISO8859-1/articles/SerialEM-howto:drift-control/article.xml 1 2013-03-06 03:00:30 xuchen Exp$

For advanced operation, especially in single particle application, drift control is a must have. There are obvious reasons for this. After stage moved, it needs some time to settle down. Without drift control, the image taken could be completely useless and a waste of time. Visually watching it might work in manual mode, but users can be subjective about what is slow and fast. Quantitative measurement is needed.

In this document, I try to show you how to do drift control before each and every final shot using macros of SerialEM. It demonstrates how powerful and flexible the macro can provide.

You can also get pdf version of this document here.


Table of Contents
1 The Task Description
2 Macro Drift
3 Integrate macro Drift into main macro

1 The Task Description

What we want to do is that after getting to each location and after Autofocus is done we measure the drifting rate. This can be done by cross-correlating two images by some time apart.

If the drifting rate is high, wait certain mount of time and measure it again. If the drifting rate reaches below the set threshold, then jump out of the drifting macro and execute the following line in the main macro which usually is taking a shot. If the drifting rate is still above the threshold after certain numbers of measurements, then skip to the end of main macro, which is to end at this location.


2 Macro Drift

Lets take a look at an example macro. The macro below was originally taken from SerialEM's helpfile. We modified it a little to suits our needs for single particle data collection.

Example 1. Drift.txt


MacroName Drift
####################################################################
# Drift.txt
# by Chen Xu at 10/11/2011
# Modified from the original code by David M
####################################################################
#
# A macro to measure drift rate, if good, skip to the end of loop. 
# Otherwise, exit execution -- i.e. skip the point.
# 

#=============
# parameters 
#=============
crit = 2
shot = F
interval = 15
times = 10

period = $interval + 1
#SuppressReports
ResetClock 

$shot
Delay $interval
Loop $times index
	$shot
	AlignTo B
	ReportAlignShift
	ClearAlignment
	dx = $reportedValue3
	dy = $reportedValue4
	dist = sqrt $dx * $dx + $dy * $dy
	rate = $dist / $period * 10	
	ReportClock
	echo Rate = $rate A/sec
	echo ----------------
  
if $rate < $crit
	echo Drift is low enough after shot $index      
	break
elseif  $index < $times
      	Delay $interval
else
      	echo Drift never got below $crit: Skipping ...
      	exit   
endif
EndLoop
      

In the above macro, we set threshold drifting rate as 2Å and measuring interval is 15 seconds.


3 Integrate macro Drift into main macro

To use the macro Drift, simply call it in the main macro after Autofocus or anywhere you like, as illustrated in the example below.

Example 2. Call macro Drift

G
G

Call Drift
R
S