Skip to content

Commit 5f9f448

Browse files
authored
FEI config mappings (#77)
* Config FEI magnification ranges * Add documentation
1 parent 916a8b0 commit 5f9f448

6 files changed

Lines changed: 39 additions & 106 deletions

File tree

docs/config.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,18 @@ This file holds all the specifications of the microscope as necessary. It is imp
271271
**ranges**
272272
: In the child items, all the magnification ranges must be defined. They can be obtained through the API using: `ctrl.magnification.get_ranges()`. This will step through all the magnifications and return them as a dictionary.
273273

274-
**range/diff**
274+
**ranges/diff**
275275
: List here the available camera lengths available on the microscope in ascending order:
276276
```yaml
277277
ranges:
278278
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000,
279279
1200, 1500, 2000, 2500, 3000, 3500, 4000, 4500]
280280
```
281281

282+
!!! note
283+
284+
For FEI/TFS machines, use `range/D` instead of `ranges/diff`.
285+
282286
**ranges/mag**
283287
: Here, mag must be one of the known mag ranges, i.e. `lowmag`, `mag1`, `samag`. What follows is a list of all available magnifications on the microscope in ascending order, for example:
284288
```yaml
@@ -289,3 +293,7 @@ ranges:
289293
400000, 500000, 600000, 800000, 1000000, 1200000,
290294
1500000, 2000000]
291295
```
296+
297+
!!! note
298+
299+
For FEI/TFS machines, the ranges are instead set as: `LM` (lowmag), `Mi` (low/intermediate mag), `SA` (high mag), `Mh` (highest mag), and `D` (diffraction mode).

docs/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In order of priority:
3535
In `config/settings.yaml` define the camera interface you want to use. You can use the autoconfig tool or one of the example files and modify those. You can name these files anything you want, as long as the name under `microscope` matches the filename in `config/microscope`
3636

3737
### __3. Set up the magnifications and camera lengths__
38-
In the config file, i.e `config/microscope/jeol.yaml`, set the correct camera lengths (`range_diff`) and magnifications for your microscopes (`range_lowmag` and `range_mag1`). Also make sure you set the wavelength. Again, the autoconfig tool is your best friend, otherwise, the way to get those numbers is to simply write them down as you turn the magnification knob on the microcope.
38+
In the config file, i.e `config/microscope/jeol.yaml`, set the correct camera lengths (`ranges/diff`) and magnifications for your microscopes (`ranges/lowmag` and `ranges/mag1`). Also make sure you set the wavelength. Again, the autoconfig tool is your best friend, otherwise, the way to get those numbers is to simply write them down as you turn the magnification knob on the microcope.
3939

4040
### __4. Set up the camera interface__
4141
Specify the file you want to use for the camera interface, i.e. `camera: timepix` points to `config/camera/timepix.yaml`. In this file, make sure that the interface is set to your camera type and update the numbers as specified in the config documentation. If you do not want to set up the camera interface at this moment, you can use `camera: simulate` to fake the camera connection.

instamatic/TEMController/fei_microscope.py

Lines changed: 13 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -28,95 +28,21 @@
2828
# 0.02: 0.593
2929
# 0.01: 0.297
3030

31-
3231
FUNCTION_MODES = {0: 'LM', 1: 'Mi', 2: 'SA', 3: 'Mh', 4: 'LAD', 5: 'D'}
3332

34-
MagnificationMapping = {
35-
1: 45,
36-
2: 58,
37-
3: 73,
38-
4: 89,
39-
5: 115,
40-
6: 145,
41-
7: 185,
42-
8: 235,
43-
9: 300,
44-
10: 380,
45-
11: 470,
46-
12: 600,
47-
13: 760,
48-
14: 950,
49-
15: 1200,
50-
16: 1550,
51-
17: 3400,
52-
18: 4400,
53-
19: 5600,
54-
20: 7200,
55-
21: 8800,
56-
22: 11500,
57-
23: 14500,
58-
24: 18500,
59-
25: 24000,
60-
26: 30000,
61-
27: 38000,
62-
28: 49000,
63-
29: 61000,
64-
30: 77000,
65-
31: 100000,
66-
32: 130000,
67-
33: 165000,
68-
34: 215000,
69-
35: 265000,
70-
36: 340000,
71-
37: 430000,
72-
38: 550000,
73-
39: 700000,
74-
40: 890000,
75-
41: 1150000,
76-
42: 1250000,
77-
43: 960000,
78-
44: 750000,
79-
45: 600000,
80-
46: 470000,
81-
47: 360000,
82-
48: 285000,
83-
49: 225000,
84-
50: 175000,
85-
51: 145000,
86-
52: 115000,
87-
53: 89000,
88-
54: 66000,
89-
55: 52000,
90-
56: 41000,
91-
57: 32000,
92-
58: 26000,
93-
59: 21000,
94-
60: 8300,
95-
61: 6200,
96-
62: 3100}
97-
98-
CameraLengthMapping = {
99-
1: 34,
100-
2: 42,
101-
3: 53,
102-
4: 68,
103-
5: 90,
104-
6: 115,
105-
7: 140,
106-
8: 175,
107-
9: 215,
108-
10: 265,
109-
11: 330,
110-
12: 420,
111-
13: 530,
112-
14: 680,
113-
15: 830,
114-
16: 1050,
115-
17: 1350,
116-
18: 1700,
117-
19: 2100,
118-
20: 2700,
119-
21: 3700}
33+
34+
def get_magnification_mapping():
35+
functions = ('LM', 'Mi', 'SA', 'Mh')
36+
values = (val for function in functions for val in config.microscope.ranges[function])
37+
return {num + 1: val for num, val in enumerate(values)}
38+
39+
40+
def get_camera_length_mapping():
41+
return {num + 1: val for num, val in enumerate(config.microscope.ranges['D'])}
42+
43+
44+
MagnificationMapping = get_magnification_mapping()
45+
CameraLengthMapping = get_camera_length_mapping()
12046

12147

12248
class FEIMicroscope:

instamatic/config/autoconfig.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ def main():
191191
if cam_config:
192192
print(f' camera: {cam_name}_cam')
193193
print()
194-
print(f'Todo: Check and update the pixelsizes in `{calib_config_fn}`')
195-
print(' In real space, pixelsize in nm')
196-
print(' In reciprocal space, pixelsize in px/Angstrom')
194+
print('Todo:')
195+
print(f' 1. Check and update the pixelsizes in `{calib_config_fn}`')
196+
print(' - In real space, pixelsize in nm')
197+
print(' - In reciprocal space, pixelsize in px/Angstrom')
198+
print(f' 2. Check and update magnification ranges in `{microscope_config_fn}`')
197199

198200

199201
if __name__ == '__main__':
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
interface: fei_simu
22
ranges:
3-
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500, 2000, 2500, 3000,
4-
3500, 4000, 4500]
5-
lowmag: [50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500,
6-
2000, 2500, 3000, 5000, 6000, 8000, 10000, 12000, 15000]
7-
mag1: [2500, 3000, 4000, 5000, 6000, 8000, 10000, 12000, 15000, 20000, 25000, 30000,
8-
40000, 50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000, 300000, 400000,
9-
500000, 600000, 800000, 1000000, 1500000, 2000000]
3+
LM: [45, 58, 73, 89, 115, 145, 185, 235, 300, 380, 470, 600, 760, 950, 1200, 1550]
4+
Mi: []
5+
SA: [3400, 4400, 5600, 7200, 8800, 11500, 14500, 18500, 24000, 30000, 38000, 49000, 61000, 77000, 100000, 130000, 165000, 215000, 265000, 340000]
6+
Mh: [430000, 550000, 700000, 890000, 1150000, 1250000, 960000, 750000, 600000, 470000, 360000, 285000, 225000, 175000, 145000, 115000, 89000, 66000, 52000, 41000, 32000, 26000, 21000, 8300, 6200, 3100]
7+
D: [34, 42, 53, 68, 90, 115, 140, 175, 215, 265, 330, 420, 530, 680, 830, 1050, 1350, 1700, 2100, 2700, 3700]
8+
LAD: []
109
wavelength: 0.019687
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
interface: fei
22
ranges:
3-
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500, 2000, 2500, 3000,
4-
3500, 4000, 4500]
5-
lowmag: [50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500,
6-
2000, 2500, 3000, 5000, 6000, 8000, 10000, 12000, 15000]
7-
mag1: [2500, 3000, 4000, 5000, 6000, 8000, 10000, 12000, 15000, 20000, 25000, 30000,
8-
40000, 50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000, 300000, 400000,
9-
500000, 600000, 800000, 1000000, 1500000, 2000000]
3+
LM: [45, 58, 73, 89, 115, 145, 185, 235, 300, 380, 470, 600, 760, 950, 1200, 1550]
4+
Mi: []
5+
SA: [3400, 4400, 5600, 7200, 8800, 11500, 14500, 18500, 24000, 30000, 38000, 49000, 61000, 77000, 100000, 130000, 165000, 215000, 265000, 340000]
6+
Mh: [430000, 550000, 700000, 890000, 1150000, 1250000, 960000, 750000, 600000, 470000, 360000, 285000, 225000, 175000, 145000, 115000, 89000, 66000, 52000, 41000, 32000, 26000, 21000, 8300, 6200, 3100]
7+
D: [34, 42, 53, 68, 90, 115, 140, 175, 215, 265, 330, 420, 530, 680, 830, 1050, 1350, 1700, 2100, 2700, 3700]
108
wavelength: 0.019687

0 commit comments

Comments
 (0)