[3DEM] microscope indicated defocus values

John Minter jrminter at rochester.rr.com
Wed May 23 15:40:55 PDT 2007

**** Messages to this list are automatically archived ***
**** Please limit quoting of previous postings to the bare minimum ****

Paul Chipman asked how different labs handle the defocus calibration on
CM-series microscopes. Our lab has an older CM-20 with the latest version of
the software available from FEI. I had noticed that the nominal defocus
steps did not change with accelerating voltage. The deviations between
nominal defocus and true defocus are greater at higher accelerating
voltages. To make a long story short, I used several software packages
(Gatan's HREM plug-in, SPIDER scripts, EMAN's CTFIT, and Niko Grigorieff's
CTFIT3) to measure the defocus values at 200kV for a wide range of defocus
values (using 768 nm nominal increments with Step 5). All the software
analyses gave consistent results, so I used the Gatan values for further
analysis because they were faster to measure. A plot of measured defocus (in
nm) as a function of nominal defocus gave a monotonic curve with a slight
deviation from linearity. I used the JMP statistical software to fit a
second order polynomial though the data. The polynomial fit was cumbersome
to use in practice.

Over the range of defocus I was most interested, it was easier to use the
Gatan HREM software to calibrate the defocus step per change in DAC units. I
then wrote a custom low-dose DigitalMicrograph script to permit focus in the
CM "focus mode", changing the defocus by a specified amount, and then
switching to exposure mode, recording the image, and setting the whole
system back to the focus mode and zero defocus. Because I like to focus at a
higher magnification than that used for recording, the script permits a
constant defocus offset to correct for that. The source for this script is
included below. Please feel free to share suggestions and improvements.

number FocusToDac( number nDefocusMicron)
   // Compute the number of DAC steps to achieve defocus
   // Calibration of 3.889±0.038 nm/ct verified 13-Feb-06

   number nFocusDacCalib = 0.003889;  // [µm] focus change per DAC Unit
   number nDacUnits;                  // step size in DAC units
   nDacUnits = Round( nDefocusMicron / nFocusDacCalib);

  return nDacUnits;

number SetSearchMode()
   number nRet;
   number nSearchKey = 6;
   number nPresses = 1;
   nRet =  CMPressSoftKey(nSearchKey, nPresses );
   return nRet;

number SetFocusMode()
   number nRet;
   number nFocusKey  = 5;
   number nPresses = 1;
   nRet =  CMPressSoftKey(nFocusKey, nPresses );
   return nRet;

number SetExposeMode()
   number nRet;
   number nExposeKey = 4;
   number nPresses = 1;
   nRet =  CMPressSoftKey(nExposeKey, nPresses );
   return nRet;

void TakeLowDoseImage(void)
   number nHardware = 1; // set to > 0 if we really have a camera
   number nExposureTime, nTop, nLeft, nCcdSize;
   number nDefocus, nDacUnits;
   number dMag;
   number nOffset;

   nExposureTime = 1;
   nTop = 0;
   nLeft = 0;
   nCcdSize = 2048;
   number bRet = GetPersistentNumberNote("TakeLowDoseImage:Defocus",
   if (!bRet)
	  nDefocus = -1.0;

   bRet = GetPersistentNumberNote("TakeLowDoseImage:Offset", nOffset);
   if (!bRet)
	  nOffset = 0.0;
   bRet = GetPersistentNumberNote("TakeLowDoseImage:Exposure",
   if (!bRet)
	  nExposureTime = 1.0;
      SetPersistentNumberNote("TakeLowDoseImage:Exposure", nExposureTime);

   bRet = GetNumber( "Enter desired defocus", nDefocus, nDefocus );
   if (bRet)
      SetPersistentNumberNote("TakeLowDoseImage:Defocus", nDefocus);
      nDacUnits = FocusToDac( nDefocus- nOffset);

      bRet = SetExposeMode();
      // let's double check the mag
      dMag = CM( );
      SetPersistentNumberNote("Microscope Info:Indicated Magnification",
      image  imgResult := SSCGainNormalizedAcquire( nExposureTime, nTop,
nLeft, nCcdSize, nCcdSize );
      bRet = SetFocusMode();
      TagGroup tg = imgResult.ImageGetTagGroup();
      SetNumberNote( imgResult, "Microscope Info:Defocus_µm", nDefocus );
      tg.TagGroupGetTagAsNumber( "Microscope Info:Defocus_µm", nDefocus );
      Result("The image was recorded with a defocus of " + nDefocus + "
[µm].\n" );   


For information on how to subscribe/unsubscribe/etc., send mail to
3dem-request at 3dem.ucsd.edu with the text "help" in the body of the

More information about the 3dem mailing list