Skip to main content

Xarray plugin to read Nanonis spectroscopy .dat files

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

nanonis-xarray is a xarray plugin 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 channel (tunnelling current, AFM oscillation amplitude, …) is a xarray.DataArray with up to three dimensions:

  • The independent variable of the measurement, such as sample 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.
>>> import xarray as xr

>>> data = xr.open_dataset("tests/data/z.dat")
>>> data.coords
Coordinates:
  * z_rel      (z_rel) float64 2kB [m] -2.1e-10 -2.065e-10 ... 4.865e-10 4.9e-10
  * sweep      (sweep) uint32 12B 1 2 3
  * direction  (direction) category 18B fw bw

pint-xarray is used to associate a physical unit to each channel, unless xr.open_dataset() is called with quantify_vars=False:

>>> data["current"].pint.units
<Unit('ampere')>

The header of the measurement is stored in the header nested dictionary:

>>> data.header["Z Spectroscopy"]["Number of sweeps"]
3
>>> data.header["Z Spectroscopy"]["backward sweep"]
True

Physical quantities are stored as pint.Quantity, timestamps as datetime.datetime, and paths as pathlib.Path:

>>> data.header["NanonisMain"]["RT Frequency"]
<Quantity(10000.0, 'hertz')>
>>> data.header["Date"]
datetime.datetime(2015, 3, 27, 11, 49, 5)

🚧 Work in progress 🚧

This library is under development: expect breaking changes. Nanonis binary formats (.sxm, .3ds) are currently not supported, and can be read by similar projects:

How to cite

Cite nanonis-xarray in your published work using the metadata in CITATION.cff. Specific DOIs and BibTeX entries for each released version can be found on Zenodo.

Metadata

Release files for nanonis-xarray 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanonis-xarray 0.1.9
File Size Uploaded
nanonis_xarray-0.1.9.tar.gz 126.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nanonis-xarray 0.1.9
File Interpreter ABI Platform
nanonis_xarray-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 136.9 kB

Release files / nanonis_xarray-0.1.9.tar.gz

Download URL nanonis_xarray-0.1.9.tar.gz
Size 126.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e0a18bc7283c49e7a45a2debc985910da7a974565706cb44f620e33f5a3dba9
BLAKE2b-256 checksum
How to use checksums
0c2b7c0899d5d2549cbf3c453b1b75e14f4231ba29c38621d40950ca8977de92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Release files / nanonis_xarray-0.1.9-py3-none-any.whl

Download URL nanonis_xarray-0.1.9-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f4604cf30e05287d7bccaab950c9398535113fdc272253c686bc86704d83126
BLAKE2b-256 checksum
How to use checksums
8c13d004c7cc59d330a6642baabd605201d78f99d97699b1e9e2e8d13721e5f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page