Project

General

Profile

Actions

Gatan K2 installation and setup » History » Revision 29

« Previous | Revision 29/47 (diff) | Next »
Anchi Cheng, 11/10/2015 06:06 PM


Gatan K2 unique installation and setup

Gatan K2 is controlled by a computer separated from the microscope

Please read Using_Leginon_on_a_system_where_the_microscope_and_camera_are_controlled_by_different_computers first.

Extra Package and Installation

  • Use all amd64 version of Windows installer
  • SerialEM DigitalMicrograph Plug-in

Thanks to David Mastronarde for providing his DM plug-in using socket connection

Note: If you have SerialEM installed on the same computer, you don't have to go through this. The same Plugin can be used by both programs and share the same port

Remove your older SEMCCDxxxx.dll in C:\Program File\Gatan\Plugins if you had it from prevous leginon-only installtion

Download and extract the files

1. From your browser, go to [[ https://bio3d.colorado.edu/ftp/SerialEM/FrameAlignment/]]
2. Choose Shrmemframe*..exe for your version of DM to download to your Gatan PC.
3. Run the downloaded file and follow its instructions.

Add a new environment variable SERIALEMCCD_PORT if not exist already from SerialEM installation. Set the value to an unused port between 50000 and 60000 to avoid conflict with other programs. Avoid ports used by Leginon, especially not 55555.

Port 50000 or 50001 usually works.

instruments.cfg

The camera modes are configured as separate cameras as follows.

  • Super Resolution should be double the size of Linear and Counting.
  • zplane will be relative to any other cameras in your system. Anything below K2 should have a lower zplane.
  • to make the images acquired from the camera to have the standard Leginon orientation, the camera configuration in Digital Micrograph will need a rotation and flip (270 degree rotation and a flip around the vertical axis on our camera) on typical FEI F20 but maybe not so post-GIF or on Krios. Therefore, the height is longer than width in the configuration below
[Gatan K2 Linear]
class: dmsem.GatanK2Linear
zplane: 50
width: 3710
height: 3838

[Gatan K2 Counting]
class: dmsem.GatanK2Counting
zplane: 50
width: 3710
height: 3838

[Gatan K2 Super]
class: dmsem.GatanK2Super
zplane: 50
width: 7420
height: 7676

If you have an Orius camera with K2, set its zplane below K2 like this:

[camera2]
class: dmsem.GatanOrius
zplane: 49
width: 2048
height: 2048

Setup
  • Set camera configuration to give the standard Leginon orientation. For example, we need 270 degree rotation and flip around the vertical axis on FEI F20. Note that the rotation required is different if it is installed post-GIF and/or on Krios.
  • Set the shutter configuration in DM to protect the specimen when camera is not taking images.
  • K2 interface in DM restricts the exposure time to multiple of some set number, depending on the mode. When you enter in DM an invalid number, it automatically change it to the valid one when you click the acquire button. pyscope/dmsem.py has hard-coded values for these precision. Compare them to the precision of the DM version you have since it may change with DM version.
  • K2 frame exposure time is adjustable in Leginon gui. However, you need to check if the number is acceptable by DM using the above method.
  • Create the folder to store the dose fractionation raw frames. Frames are saved as unsigned 16-bit mrc image stack in K2 computer under D:\frames by default as set in the code inside pyscope/dmsem.py in the function calculateFileSavingParams. You must create the frames directory first. Leginon will not do that for you. You may change where the frames are saved here but will need to make corresponding changes when setting up raw frame file transfer
  • Setup raw frame file transfer from a network data server.
  • Unless you want to develop your own frame alignment program. We recommend that you use Appion to do frame gain correction and alignment. These are parallelized by images so it cam almost keep up with the acquisition.

(Version 3.0) Change Flag in pyscope/dmsem.py if you have DM 2.30 version and requires flip/rotation to give the Leginon orientation.

In standard python site-package installation, this file is at C:\Python27\Lib\site-packages\pyscope\dmsem.py

Find this line near the top:

isDM230 = False

Change it to
isDM230 = True

(Version 3.1) Define local configuration

In C:\Python27\Lib\site-packages\pyscope/dmsem.py

# DM Version
DM_VERSION = '2.30.542.0'
# the value in DM camera config
K2_CONFIG_FLIP = True
# multiple of 90 degrees (i.e. put 1 if 90 degrees, 3 if 270 degrees)
K2_CONFIG_ROTATE = 3
# raw frame base directory. Use '\\' as path separator
RAW_FRAME_DIR = 'D:\\frames\\'

1. Find DM_Version in DM gui under its menu bar : /Help/About DigitalMicrograph
2. Fill in K2_CONFIG_FLIP and K2_CONFIG_ROTATE according to DM gui under its menu bar: /Camera/Configure Camera. The comment line above the value setting explains the meaning of the value.
3. Enter the drive the directory where raw frames will be saved.

(Version 3.2) Define local configuration in dmsem.cfg

  1. Copy from your myami checkout pyscope/dmsem.cfg.template to C:\Program Files\myami\dmsem.cfg
  2. Make changes to the configured value in dmsem.cfg

Most parameters are explained above.

  • The config parser takes "'" and "\" literally. Therefore, do not include "'" in DM_VERION and RAW_FRAME_DIR. In addition, the path separator should be "\"
  • CAMERA_ID is usually 0. In the older version, it is defined in the same name below
    class GatanK2Base(DMSEM):
    
  • EARLY_RETURN_FRAME_COUNT specifies the number of frames you want to integrate and return to you before all frames are saved. This reduces idle time for the scope, but it may cause memory leak in super-resolution mode See Issue #3750 for update on this feature.

Testing with pyscope

  1. Start DigitalMicrograph
  2. From python command line or IDLE:
    import pyscope.dmsem
    k = pyscope.dmsem.GatanK2Counting()
    k.setExposureTime(200)
    k.getImage()

You should expect these to run without error. The getImage() command should give a 2D numpy array like

array([[1000, 3400, 2300, ..., 1000,1200,3000],
         [1000, 3400, 2300, ..., 1000,1200,3000],
         [1000, 3400, 2300, ..., 1000,1200,3000],
         ...,
         [1000, 3400, 2300, ..., 1000,1200,3000],
         [1000, 3400, 2300, ..., 1000,1200,3000],
         [1000, 3400, 2300, ..., 1000,1200,3000],dtype=int16)

The number and dtype depends on the camera.

a.shape command should give a tuple of the camera dimension matching your camera.
For example, (4096,4096)

If you use python shell to do this test, some of the error will cause the shell window to close immediately. Use Python IDLE instead in that case

Testing frame saving

You can continue the test above by saving frames, too.

k.setSaveRawFrames(True)
k.setExposureTime(200)
a=k.getImage()
a.shape
* The last command should give you the shape of the summed image, and the frame movie should show up on your frames directory

testing energy filter

  1. Start DigitalMicrograph
  2. From python command line or IDLE:
    import pyscope.dmsem
    k = pyscope.dmsem.GatanK2Counting()
    k.getEnergyFiltered()
    k.getEnergyFilter()
    k.setEnergyFilter(True)
    k.getEnergyFilter()
    k.setEnergyFilter(False)
    k.getEnergyFilter()
    k.getEnergyFilterWidth()
    

Programs to open before Leginon Client: Digital Micrograph

See more about K2 implementation in Using_Gatan_K2_Summit_in_Leginon

Updated by Anchi Cheng about 9 years ago · 29 revisions