Skip to content

Commit

Permalink
FEI config mappings (#77)
Browse files Browse the repository at this point in the history
* Config FEI magnification ranges

* Add documentation
  • Loading branch information
stefsmeets committed Jun 16, 2023
1 parent 916a8b0 commit 5f9f448
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 106 deletions.
10 changes: 9 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,18 @@ This file holds all the specifications of the microscope as necessary. It is imp
**ranges**
: 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.

**range/diff**
**ranges/diff**
: List here the available camera lengths available on the microscope in ascending order:
```yaml
ranges:
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000,
1200, 1500, 2000, 2500, 3000, 3500, 4000, 4500]
```

!!! note

For FEI/TFS machines, use `range/D` instead of `ranges/diff`.

**ranges/mag**
: 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:
```yaml
Expand All @@ -289,3 +293,7 @@ ranges:
400000, 500000, 600000, 800000, 1000000, 1200000,
1500000, 2000000]
```

!!! note

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).
2 changes: 1 addition & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In order of priority:
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`

### __3. Set up the magnifications and camera lengths__
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.
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.

### __4. Set up the camera interface__
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.
Expand Down
100 changes: 13 additions & 87 deletions instamatic/TEMController/fei_microscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,95 +28,21 @@
# 0.02: 0.593
# 0.01: 0.297


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

MagnificationMapping = {
1: 45,
2: 58,
3: 73,
4: 89,
5: 115,
6: 145,
7: 185,
8: 235,
9: 300,
10: 380,
11: 470,
12: 600,
13: 760,
14: 950,
15: 1200,
16: 1550,
17: 3400,
18: 4400,
19: 5600,
20: 7200,
21: 8800,
22: 11500,
23: 14500,
24: 18500,
25: 24000,
26: 30000,
27: 38000,
28: 49000,
29: 61000,
30: 77000,
31: 100000,
32: 130000,
33: 165000,
34: 215000,
35: 265000,
36: 340000,
37: 430000,
38: 550000,
39: 700000,
40: 890000,
41: 1150000,
42: 1250000,
43: 960000,
44: 750000,
45: 600000,
46: 470000,
47: 360000,
48: 285000,
49: 225000,
50: 175000,
51: 145000,
52: 115000,
53: 89000,
54: 66000,
55: 52000,
56: 41000,
57: 32000,
58: 26000,
59: 21000,
60: 8300,
61: 6200,
62: 3100}

CameraLengthMapping = {
1: 34,
2: 42,
3: 53,
4: 68,
5: 90,
6: 115,
7: 140,
8: 175,
9: 215,
10: 265,
11: 330,
12: 420,
13: 530,
14: 680,
15: 830,
16: 1050,
17: 1350,
18: 1700,
19: 2100,
20: 2700,
21: 3700}

def get_magnification_mapping():
functions = ('LM', 'Mi', 'SA', 'Mh')
values = (val for function in functions for val in config.microscope.ranges[function])
return {num + 1: val for num, val in enumerate(values)}


def get_camera_length_mapping():
return {num + 1: val for num, val in enumerate(config.microscope.ranges['D'])}


MagnificationMapping = get_magnification_mapping()
CameraLengthMapping = get_camera_length_mapping()


class FEIMicroscope:
Expand Down
8 changes: 5 additions & 3 deletions instamatic/config/autoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ def main():
if cam_config:
print(f' camera: {cam_name}_cam')
print()
print(f'Todo: Check and update the pixelsizes in `{calib_config_fn}`')
print(' In real space, pixelsize in nm')
print(' In reciprocal space, pixelsize in px/Angstrom')
print('Todo:')
print(f' 1. Check and update the pixelsizes in `{calib_config_fn}`')
print(' - In real space, pixelsize in nm')
print(' - In reciprocal space, pixelsize in px/Angstrom')
print(f' 2. Check and update magnification ranges in `{microscope_config_fn}`')


if __name__ == '__main__':
Expand Down
13 changes: 6 additions & 7 deletions instamatic/config/microscope/fei_simu.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
interface: fei_simu
ranges:
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500, 2000, 2500, 3000,
3500, 4000, 4500]
lowmag: [50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500,
2000, 2500, 3000, 5000, 6000, 8000, 10000, 12000, 15000]
mag1: [2500, 3000, 4000, 5000, 6000, 8000, 10000, 12000, 15000, 20000, 25000, 30000,
40000, 50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000, 300000, 400000,
500000, 600000, 800000, 1000000, 1500000, 2000000]
LM: [45, 58, 73, 89, 115, 145, 185, 235, 300, 380, 470, 600, 760, 950, 1200, 1550]
Mi: []
SA: [3400, 4400, 5600, 7200, 8800, 11500, 14500, 18500, 24000, 30000, 38000, 49000, 61000, 77000, 100000, 130000, 165000, 215000, 265000, 340000]
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]
D: [34, 42, 53, 68, 90, 115, 140, 175, 215, 265, 330, 420, 530, 680, 830, 1050, 1350, 1700, 2100, 2700, 3700]
LAD: []
wavelength: 0.019687
12 changes: 5 additions & 7 deletions instamatic/config/microscope/fei_themisZ.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
interface: fei
ranges:
diff: [150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500, 2000, 2500, 3000,
3500, 4000, 4500]
lowmag: [50, 80, 100, 150, 200, 250, 300, 400, 500, 600, 800, 1000, 1200, 1500,
2000, 2500, 3000, 5000, 6000, 8000, 10000, 12000, 15000]
mag1: [2500, 3000, 4000, 5000, 6000, 8000, 10000, 12000, 15000, 20000, 25000, 30000,
40000, 50000, 60000, 80000, 100000, 120000, 150000, 200000, 250000, 300000, 400000,
500000, 600000, 800000, 1000000, 1500000, 2000000]
LM: [45, 58, 73, 89, 115, 145, 185, 235, 300, 380, 470, 600, 760, 950, 1200, 1550]
Mi: []
SA: [3400, 4400, 5600, 7200, 8800, 11500, 14500, 18500, 24000, 30000, 38000, 49000, 61000, 77000, 100000, 130000, 165000, 215000, 265000, 340000]
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]
D: [34, 42, 53, 68, 90, 115, 140, 175, 215, 265, 330, 420, 530, 680, 830, 1050, 1350, 1700, 2100, 2700, 3700]
wavelength: 0.019687

0 comments on commit 5f9f448

Please sign in to comment.