One of the most significant developments in the recent history of electron microscopy is beam shaping. Through electron optical components, based on microelectromechanical systems technology, it is possible to generate vortex beams , non-diffracting beams , compact aberration correctors  and quantum state analysers .
Although the basic concept of the operation of each lens and optical element is known, the overall behaviour of the microscope is not predictable in detail and the quality of microscope performance is limited by the skill of the user.
Recent years have seen the exponential growth of Artificial Intelligence (AI) which have clearly demonstrated their ability to control a variety of complex systems ranging from large industrial machines, through vehicles, to small appliances in our homes.
We make use of artificial neural networks (ANN) , a class of AIs able to autonomously learn from a large set of training examples, how to govern electron optical devices within a transmission electron microscope.
We are motivated by the specific case of an orbital angular momentum (OAM) sorter , which makes use of electron beam shaping to measure an electron beam’s component of OAM in the propagation direction.
After the training, the CNN is capable of correctly identify the microscope configuration (parameters like defocus, misalignments and the excitation of the OAM sorter) from a single spectrum image and to suggest the corrections required to reach ideal resolution.
The proposed method is not however limited to the OAM sorter. Such an approach can be applied in real time to align other complex experimental apparatus, based on minimal experimental data. We envisage that in the future experimental devices will be able to self-diagnose and communicate with operators in real-time.
 A. H. Tavabi, et al. Phys. Rev. Research, 2 (2020), 013185.
 V. Grillo, et al. Phys. Rev. X, 4 (2014), 011013.
 V. Grillo et al. Opt. Express, 25 (2017), 21851.
 A.H. Tavabi et al. arXiv: 1910.03706.
 K. Simonyan, et al. arXiv: 1409.1556v6.
 M. Weigert, et al. Nat. Methods, 15 (2018), 1090–1097.