Nanosurf Scripting Interface

Python API for data acquisition and control of Nanosurf atomic force microscopes

At Nanosurf we realize that leading researchers are often interested in modifying the standard routines of an instrument, or else everyone would be doing the same thing with the same hardware.

Sometimes there are also application-specific routines, the scope of which we cannot predict and program ourselves. This is why we developed the Nanosurf Scripting Interface.

This interface can be used for automation of routine tasks and for creating new experiments. It gives the users full control over our user interface, and some control over the hardware functionality.

The Nanosurf control software publishes its functionality via the COM interface, by running an instance of COM Automation Server. COM Automation Clients can ask the server during the runtime about its functions and access them. These functions can be accessed through most modern programming languages: Python, C++, C#, VBS, Matlab, JS, LabView, etc.

For ease of use, Nanosurf has created a Python API for its COM interface. We chose Python as our API language, because of its ease of use and learning, popularity and universality, and because of number of data and image processing libraries used in academia and industry.

The Nanosurf Python package can be downloaded and installed from PyPI using pip:

pip install nanosurf

The Nanosurf Python package

Learn how to take control of the GUI settings in Python: the video above shows some of the most basic actions, such as changing the imaging mode, choosing the right cantilever, adjusting image parameters, and changing the PID settings. Also see how to automatically find the working frequency, start approach, start scanning, and save measurement data.

Watch the on-demand webinar on Nanosurf's Python API

In this webinar we introduce the Nanosurf Python API and learn how to control Nanosurf instruments with it. We also briefly touch on the processing of the data, stored in NID files, and look at how to create custom user interfaces.

Nanosurf control software