Sample code (TEM3)

This page presents a simple sample code using the TEM3 package.

The functions to be introduced are as follows

  • Get a list of detectors that can be controlled

  • Get or set a detector information

  • Image capturing

Prerequisites

  • TEMCenter is running (in the case of online)

  • TEMServer is running (in the case of online)

  • Ver.1.3.0 (Operation check environment)

0. Import TEM3


[1]:
# online
from PyJEM import TEM3
TEM3.connect()

## offline
#from PyJEM,offline import TEM3
#TEM3.connect()

1. Get current mag value


  • Use GetMagValue() function in EOS class to get the value.

1.1. Create EOS instance

[2]:
eos = TEM3.EOS3()

1.2. Call GetMagValue method

[3]:
eos.GetMagValue()
[3]:
[200, 'X', 'X200']

2. Change the magnification


  • The magnification can be changed with SetSelector() defined in TEM3.EOS3().

    • SetSelector () has one argument and will be changed to a magnification according to the entered value.

    • The input value is 0 to 40 in index.

  • The Set function has no return value. You can check the changed magnification with GetMagValue ().

2.1. Call a SetSelector method

  • change to 1 (index) mag value.

[19]:
eos.SetSelector(1)

2.2. Check TEM state

[6]:
eos.GetMagValue()
[6]:
[250, 'X', 'X250']

3. Increase the magnification by some step


10 steps from the current magnification using the for statement

  • Use “for” statement

    >>> for i in range(10):
    
  • Use function UpSelector() to increase the magnification one step at a time.

3.1. Execute

[20]:
for i in range(10):
    eos.UpSelector()
    print(eos.GetMagValue())
[300, 'X', 'X300']
[400, 'X', 'X400']
[500, 'X', 'X500']
[600, 'X', 'X600']
[800, 'X', 'X800']
[1000, 'X', 'X1000']
[1200, 'X', 'X1200']
[1500, 'X', 'X1500']
[2000, 'X', 'X2000']
[2500, 'X', 'X2500']