5 Adjust Z to Eucentric Height

Here is an example macro to adjust Z height after resetting objective lens and measuring defocus.

Example 4. Z_byG.txt


MacroName Z_byG
##############################
# Z_byG.txt
# by Chen Xu, Mod. Feb. 8, 2013
##############################
#
# a macro to adjust the eccentric center using beam tilted pairs.
# It uses Autofocus to measure the focus and adjust Z instead.
#
# assume there are calibration entries for Calibration - Standard Focus

#==================
# set object lens 
#==================
SetEucentricFocus
NormalizeLenses 2
Delay 1

#===========
# Adjust Z
#===========
Loop 2
Autofocus -1
ReportAutofocus 
t = -1 * $reportedValue1
MoveStage 0 0 $t
echo --> Z moved $t micron 
EndLoop
#=== end ====

The current develop (beta) version of SerialEM allows to use View beam to do autofocus. This is very helpful, especially in the situation one wants to quickly adjust specimen to roughly eucentrici height without exiting from Low Dose mode. For example, when at a new mesh, running following macro while in Low-Dose mode can bring that mesh to close to eucentricity easily and without wobbling the stage.

Example 5. Z_byV


MacroName Z_byV
##############################
# Z_byV.txt
# by Chen Xu, Oct  23, 2010, 
# Last modified: 2014-10-06 12:21:26
##############################
# 

#====================================
# for defocus offset of V in Low Dose, save it
# ===================================
GoToLowDoseArea V
SaveFocus

#==================
# set object lens 
#==================
SetEucentricFocus
NormalizeLenses 2
Delay 1

#===========
# Adjust Z
#===========
Loop 2
Autofocus -1 1
ReportAutofocus 
Z = -1 * $reportedValue1
MoveStage 0 0 $Z
echo Z has moved --> $Z micron 
EndLoop

#=========================================
# restore the defocus set in V originally
# ========================================
RestoreFocus

The real difference of this macro from the previous one is the 1 as the last argument of line of measuring focus. It means to use V instead of F in Low Dose mode.

Autofocus -1 1

Note: There are two new macro commands in above updated macro - SaveFocus and RestoreFocus. One hidden beauty for these two commands is that they are at macro control level. SaveFocus saves a focus value and this value gets restored even the macro is stopped before line of RestoreFocus. This way, with large V focus offset, there is no risk to get scope objective lens to wrongly high value, even the macro is interrupted in the middle of "adjusting Z".