Project

General

Profile

Aperture selection through tem controller » History » Version 5

Anchi Cheng, 04/29/2020 05:24 PM

1 1 Anchi Cheng
h1. Aperture selection through tem controller
2
3
This feature allows selection of aperture of TFS microscopes with automated apertures.  The current implementation uses AutoIt Scripting and reads the configuration from c:\Program Files (x86)\myami\fei.cfg
4
5
h2. Setup
6
7
h3. compile autoit script
8
9 5 Anchi Cheng
See [[AutoIt_program_and_script_compilation]]
10
11 1 Anchi Cheng
The script is pyscope/autoit/ApertureSelection.au3
12 2 Anchi Cheng
Use AutoIt suite to compile it.  Either 32 or 64-bit version works as far as I know.  Save the executable at the place you plan to specify in fei.cfg
13 1 Anchi Cheng
14
h3. Setup pyscope fei.cfg
15
16
Copy from pyscope/fei.cfg.template these lines to fei.cfg used on your scope.  In standard installation, this should be "c:\Program Files (x86)\myami\fei.cfg"
17 5 Anchi Cheng
18
*Note: The current script assumes fei.cfg is in the above-mentioned location.  If you put it somewhere else, please change the autoit script to reflect that.*
19 1 Anchi Cheng
20
Modify these settings according to your scope.
21
22
<pre>
23
[aperture]
24
# Disable control of auto apertures if not working or not available
25
# not all versions of microscope software allows auto aperture control
26
# from scripting level.
27
USE_AUTO_APERTURE = False
28
# AutoIt Automation
29
AUTOIT_APERTURE_SELECTION_EXE_PATH = c:\Users\supervisor\Desktop\Anchi\AutoItScripts\ApertureSelection.exe
30
# Does the Titan column has automated c3 aperture ?  This affects the id of the
31
# gui button for AutoIt script. 
32
HAS_AUTO_C3 = True
33
# Individual aperture selections.  If retractable, add open at the end of the list
34 2 Anchi Cheng
# List these in the order of what appears in the TUI
35 1 Anchi Cheng
# Note: can not handle multiple apertures of the same name.
36
CONDENSER_2 = 150, 100, 50, 20
37
OBJECTIVE = 100, 70, 50, open
38
# Optional selected area aperture control. comment or remove the line to deactivate it.
39
SELECTED_AREA = 200,100, 40, 10, open
40 2 Anchi Cheng
41
</pre>
42
43
h2. Testing
44
45
h3. Testing the AutoIt executable
46
47
# Open TEM user interface.
48
# Retract the objective aperture.
49
# Double click Autoit executable to run.
50
If this works right, it should insert the 100 um aperture.
51
52
h3. Testing in with python command from pyscope
53
54
<pre>
55
from pyscope import fei
56
f=fei.Krios()  # Change this to match your instrument class
57
58
f.getApertureSelections('objective') # This should give you the list you specified in fei.cfg
59
'100', '70', '50' , 'open'
60
61
f.getApertureSelection('objective')  # The returned value should be the current aperture position as a string
62
'100'
63
64
f.setApertureSelection('objective', '50') # This should insert the 50 um aperture
65
66
f.retractApertureMechanism('objective') # This should retract the aperture as if you click on the Activate/Deactivate aperture button to disable it.
67 1 Anchi Cheng
68
</pre>
69 3 Anchi Cheng
70
h2. Use it in Leginon
71
72 4 Anchi Cheng
The most likely usage of this is  in [[TEM_Controller|TEM controller]] (aliased as TEM_Remote in MSI application).