2 Speed up using Modulo function

In single particle application, for each target position, we usually do a few things: centering beam, autofocusing, waiting for drift etc.. However, it is often found the local area are pretty much the same and we don't really need to perform each of these actions for every target position. It is quite OK to skip these actions for a few positions nearby and just take a shot. In SerialEM, this is done by using a macro function Modulo. Lets take a look at the following macro:

Example 1. LD_Modulo.txt


MacroName LD_Modulo

# point to do things (5,10,15...), skip between
point = 5

RealignToNavItem 1
Call ZeroIS-quick

# find index number for current acquire
ReportNavItem
echo Acquiring Item is $navAcqIndex
remainder = modulo $navAcqIndex $point

# find GroupStatus for current item. It is 1 for first 
# acquire item in the group.
# It is recommended to have a new group for each mesh.
ReportGroupStatus
GS = $reportedValue1

Loop 1
if $remainder == 0 OR $GS == 1
    # CenterBeam, assume autocenter policy has been setup
    AutoCenterBeam
    # change focus target
    Call CycleTargetDefocus
    # actual focus, twice
    G
    G
else
    break
Endif 
Endloop

R
S

One thing to be mentioned in above example is


   $navAcqIndex

This is an index number of the item with "A" - Acquire flag in navigator window. The idea is to do a few things only for very first "A" item and the period "A" item, and all the other item points are skipped. This skipped points are only to take exposure.

As you can see, this would speed up things a lot.