TEM Architecture

pyTEM

pyTEM is the main hierarchical state machine orchestrating all the components. This service uses the Pigeon client for communication via the message broker. Furthermore, a library integrating Pigeon and the Python Transitions library to allow easy creation of the state machine. This library can also create a state transition diagrams of the state machine:

State Diagram

Simplified State Diagram

A simplified version of this schematic is:

%3 cluster_Preview Preview cluster_Acquisition Acquisition cluster_Montage Montage 5adf688626924128b0822621cdc394cd UpdateImage 00a1d75a6aae45ffa57de0d8fce99efe Brightfield 5adf688626924128b0822621cdc394cd->00a1d75a6aae45ffa57de0d8fce99efe 59bc02f340c44b18be7b3a52e015ed47 Darkfield 5adf688626924128b0822621cdc394cd->59bc02f340c44b18be7b3a52e015ed47 de46e8d03f2e485581b6d5672491c856 AutoFocus 5adf688626924128b0822621cdc394cd->de46e8d03f2e485581b6d5672491c856 40487f0e0b574d34a8ceab80acdb0b48 AutoExposure 5adf688626924128b0822621cdc394cd->40487f0e0b574d34a8ceab80acdb0b48 e106ec53b91a41debd5aa59897f9582e BeamCenter 5adf688626924128b0822621cdc394cd->e106ec53b91a41debd5aa59897f9582e 5050d149179e4cc39b518153c3a62599 BeamSpread 5adf688626924128b0822621cdc394cd->5050d149179e4cc39b518153c3a62599 99773437e2014c7d9009bad8707d11f7 ChangeAperture 5adf688626924128b0822621cdc394cd->99773437e2014c7d9009bad8707d11f7 e37f549da2b94bc48366269572017a87 LensCorrection 5adf688626924128b0822621cdc394cd->e37f549da2b94bc48366269572017a87 a17959a9f70c4843b47bebfe3169a99d FindAperture 5adf688626924128b0822621cdc394cd->a17959a9f70c4843b47bebfe3169a99d 788c6ba444f04d2684e859c89f04e673 ChangeAperture 5adf688626924128b0822621cdc394cd->788c6ba444f04d2684e859c89f04e673 6ebdce7b74484daf9bc439e8ef1ef9ae Shutdown 5adf688626924128b0822621cdc394cd->6ebdce7b74484daf9bc439e8ef1ef9ae 84341b2d51ae451ead7bfee4a040d295 FindAperture 788c6ba444f04d2684e859c89f04e673->84341b2d51ae451ead7bfee4a040d295 627d684350fa464e9cbb2df2a423ca2f AutoExposure 84341b2d51ae451ead7bfee4a040d295->627d684350fa464e9cbb2df2a423ca2f 87979cf578094f3f9fa3c2975644b484 BeamCenter 627d684350fa464e9cbb2df2a423ca2f->87979cf578094f3f9fa3c2975644b484 405ca24aeb8f4f83a5d9bbfc5c891f3b BeamSpread 87979cf578094f3f9fa3c2975644b484->405ca24aeb8f4f83a5d9bbfc5c891f3b 1d3cd9eec7374ebe946ba0ab3d56e8b5 Brightfield 405ca24aeb8f4f83a5d9bbfc5c891f3b->1d3cd9eec7374ebe946ba0ab3d56e8b5 fe07e188b0824a8092130e19f111226a Darkfield 1d3cd9eec7374ebe946ba0ab3d56e8b5->fe07e188b0824a8092130e19f111226a 02579d4e08d54d77870c4164bd58e2fd AutoFocus fe07e188b0824a8092130e19f111226a->02579d4e08d54d77870c4164bd58e2fd 36439059a1d94c90b9dc8f13e89e1940 LensCorrection 02579d4e08d54d77870c4164bd58e2fd->36439059a1d94c90b9dc8f13e89e1940 a7fb9615b56d441a935f533e00d04718 MoveStage 02579d4e08d54d77870c4164bd58e2fd->a7fb9615b56d441a935f533e00d04718 36439059a1d94c90b9dc8f13e89e1940->a7fb9615b56d441a935f533e00d04718 3a148ccd2b3047c2a2f45441b10bd514 CaptureTile a7fb9615b56d441a935f533e00d04718->3a148ccd2b3047c2a2f45441b10bd514 3a148ccd2b3047c2a2f45441b10bd514->788c6ba444f04d2684e859c89f04e673 3a148ccd2b3047c2a2f45441b10bd514->6ebdce7b74484daf9bc439e8ef1ef9ae

Below, the functionality of each of “states” shown above is detailed. In reality, each of these “states” is a state machine in and of itself.

Preview

The Preview machine is used for previewing the image data, and checking that the microscope functions as expected.

Acquisition

The Acquisition machine is used to set up and capture a montage.

Montage

The Montage machine collects the required tiles.

UpdateImage

The UpdateImage machine requests an image from the camera, and sends it to the image processing pipeline. Ultimately, this image will then be shown on the UI.

Darkfield

The Darkfield machine collects a darkfield image by lowering the screen on the microcope, collecting a series of images, averaging them, then raising the screen again.

Brightfield

The Brightfield machine collects a brightfield image by moving the stage while collecting a series of images, then averaging them.

AutoFocus

The AutoFocus machine optimizes the focus by maximizing the focus score produced by the image processing pipeline.

AutoExposure

The AutoExposure machine optimizes the exposure by finding the camera exposure which produces a mean value within the correct range as calculated by the image processing pipeline.

BeamCenter

The BeamCenter machine centers the electron beam in the microscope’s field of view.

BeamSpread

The BeamSpread machine spreads the beam to get an even density of electrons over the field of view.

ChangeAperture

The ChangeAperture machine changes the current aperture of the tape or stick that is being imaged.

LensCorrection

The LensCorrection machine collects a lens correction montage.

FindAperture

The FindAperture machine finds the bounds of the current aperture by moving the stage and processing images.

MoveStage

The MoveStage machine moves the stage to the location of the next tile.

CaptureTile

The CaptureTile machine captures a single tile using the camera.

Shutdown

In the Shutdown machine, the microscope is placed into a safe state. Ideally, the beam is turned off, and the screen is lowered.

Note:

Historically, orchestration of all components was accomplished using pytemca documented here.