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 89d9f418e14e47c880f45198a4fd15d5 UpdateImage 5efde300780a4e8f9e1fa8498caeb504 Brightfield 89d9f418e14e47c880f45198a4fd15d5->5efde300780a4e8f9e1fa8498caeb504 52979f4ab4714a3d96e281767f57c0f9 Darkfield 89d9f418e14e47c880f45198a4fd15d5->52979f4ab4714a3d96e281767f57c0f9 e71da1afad5d40e090c46b21e0aa864b AutoFocus 89d9f418e14e47c880f45198a4fd15d5->e71da1afad5d40e090c46b21e0aa864b 0f974c6b3ed844c394a5b54e8af32929 AutoExposure 89d9f418e14e47c880f45198a4fd15d5->0f974c6b3ed844c394a5b54e8af32929 996f17396bae415cae788794edbcf9d8 BeamCenter 89d9f418e14e47c880f45198a4fd15d5->996f17396bae415cae788794edbcf9d8 fd5a8f0b6ccd4f16ac6862ed3331f79a BeamSpread 89d9f418e14e47c880f45198a4fd15d5->fd5a8f0b6ccd4f16ac6862ed3331f79a da3a3fa999064e3e8d9635878b2d6764 ChangeAperture 89d9f418e14e47c880f45198a4fd15d5->da3a3fa999064e3e8d9635878b2d6764 9e73654d998e4e1494c095a46285739a LensCorrection 89d9f418e14e47c880f45198a4fd15d5->9e73654d998e4e1494c095a46285739a 38f60989eaf94ec3a081a2b21949e32e FindAperture 89d9f418e14e47c880f45198a4fd15d5->38f60989eaf94ec3a081a2b21949e32e a5eafb7abca4432da0a0201e14d0a7d2 ChangeAperture 89d9f418e14e47c880f45198a4fd15d5->a5eafb7abca4432da0a0201e14d0a7d2 a5c2257c7d764bc2b1a85da37d797ab5 Shutdown 89d9f418e14e47c880f45198a4fd15d5->a5c2257c7d764bc2b1a85da37d797ab5 b00af58364024bbcbda9d535deb71613 FindAperture a5eafb7abca4432da0a0201e14d0a7d2->b00af58364024bbcbda9d535deb71613 174f6840d2114332a6d4743368777b4d AutoExposure b00af58364024bbcbda9d535deb71613->174f6840d2114332a6d4743368777b4d 5ff9dd9662bd4271990d8e4073f14af8 BeamCenter 174f6840d2114332a6d4743368777b4d->5ff9dd9662bd4271990d8e4073f14af8 a17a6e4e1fcf482498b46347d77be22e BeamSpread 5ff9dd9662bd4271990d8e4073f14af8->a17a6e4e1fcf482498b46347d77be22e 25be1582b5cc44c3b8105851644dfbad Brightfield a17a6e4e1fcf482498b46347d77be22e->25be1582b5cc44c3b8105851644dfbad 4afa9cc53d1646f68f4c0bf7491a8a83 Darkfield 25be1582b5cc44c3b8105851644dfbad->4afa9cc53d1646f68f4c0bf7491a8a83 5bfb1ec974d146a1a038b629c535d999 AutoFocus 4afa9cc53d1646f68f4c0bf7491a8a83->5bfb1ec974d146a1a038b629c535d999 c614a4c16715435fa8e6b8e0834481e4 LensCorrection 5bfb1ec974d146a1a038b629c535d999->c614a4c16715435fa8e6b8e0834481e4 14c79f3d11824ec494f17f4e86ab34bb MoveStage 5bfb1ec974d146a1a038b629c535d999->14c79f3d11824ec494f17f4e86ab34bb c614a4c16715435fa8e6b8e0834481e4->14c79f3d11824ec494f17f4e86ab34bb 6b6b4224d5ae4b299e496a55b2bc2ff7 CaptureTile 14c79f3d11824ec494f17f4e86ab34bb->6b6b4224d5ae4b299e496a55b2bc2ff7 6b6b4224d5ae4b299e496a55b2bc2ff7->a5eafb7abca4432da0a0201e14d0a7d2 6b6b4224d5ae4b299e496a55b2bc2ff7->a5c2257c7d764bc2b1a85da37d797ab5

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.