Skip to content

angelo-peronio/nanonis-xarray

Repository files navigation

Read Nanonis spectroscopy .dat files into xarray Datasets

pypi license python SPEC 0 — Minimum Supported Dependencies ci pre-commit.ci status codecov ruff

nanonis_xarray is a Python module to read spectroscopy measurements saved in text format (.dat) by a Nanonis Mimea SPM control system from SPECS Surface Nano Analysis GmbH.

The data is read into a xarray.Dataset, where each measured quantity, such as tunnelling current or AFM oscillation amplitude, is a xarray.DataArray with up to three dimensions:

  • The independent variable of the measurement, such as bias voltage or tip z position;
  • The sweep number, if the measurement has been repeated multiple times;
  • The sweep direction (forward or backward), if the independent variable has been swept in both directions.

It becomes then easy to e.g. plot the average of one measured channel in the forward direction:

from matplotlib import pyplot as plt

from nanonis_xarray import read_dat

data = read_dat("tests/data/z.dat")
fig, ax = plt.subplots()
data["current"].mean(dim=["sweep"]).sel(direction="fw").plot()

Work in progress

This library is under development: expect breaking changes. I do not plan to support the Nanonis binary formats (.sxm, .3ds), which can be read by similar projects: