  Microscopy, in particular scanning probe and electron microscopy, has been
pivotal in improving our understanding of structure-function relationships at
the nanoscale and is by now ubiquitous in most research characterization labs
and facilities. However, traditional microscopy operations are still limited
largely by a human-centric click-and-go paradigm utilizing vendor-provided
software, which necessarily limits the scope, utility, efficiency,
effectiveness, and at times reproducibility of microscopy experiments. Here, we
develop a coupled hardware-software platform that consists of a
field-programmable gate array (FPGA) device, with LabView-built customized
acquisition scripts, along with a software package termed AEcroscoPy (short for
Automated Experiments in Microscopy driven by Python) that overcome these
limitations and provide the necessary abstractions towards full automation of
microscopy platforms. The platform works across multiple vendor devices on
scanning probe microscopes and scanning transmission electron microscopes. It
enables customized scan trajectories, processing functions that can be
triggered locally or remotely on processing servers, user-defined excitation
waveforms, standardization of data models, and completely seamless operation
through simple Python commands to enable a plethora of microscopy experiments
to be performed in a reproducible, automated manner. This platform can be
readily coupled with existing machine learning libraries as well as
simulations, to provide automated decision-making and active theory-experiment
optimization loops to turn microscopes from characterization tools to
instruments capable of autonomous model refinement and physics discovery.
