Metadata-Version: 2.4
Name: nanonis-xarray
Version: 0.1.1
Summary: Read a Nanonis spectroscopy .dat file into a xarray Dataset
Author: Angelo Peronio
License-Expression: MIT
License-File: LICENSE
Keywords: AFM,Atomic Force Microscopy,Inelastic Electron Tunnelling Spectroscopy,Mimea,Nanonis,SPECS,SPS,STM,STM-IETS,STS,Scanning Probe Spectroscopy,Scanning Tunnelling Microscopy,Scanning Tunnelling Spectroscopy,xarray
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: File Formats
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Requires-Dist: pint-xarray>=0.4
Requires-Dist: xarray>=2023.9.0
Description-Content-Type: text/markdown

# Read Nanonis spectroscopy .dat files into xarray Datasets

[![pypi](https://img.shields.io/pypi/v/nanonis-xarray)](https://pypi.org/project/nanonis-xarray/)
[![license](https://img.shields.io/github/license/angelo-peronio/nanonis-xarray)](https://github.com/angelo-peronio/nanonis-xarray/blob/master/LICENSE)
[![python](https://img.shields.io/pypi/pyversions/nanonis-xarray)](https://pypi.org/project/nanonis-xarray/)
[![SPEC 0 — Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)
[![ci](https://github.com/angelo-peronio/nanonis-xarray/actions/workflows/ci.yaml/badge.svg)](https://github.com/angelo-peronio/nanonis-xarray/actions/workflows/ci.yaml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/angelo-peronio/nanonis-xarray/master.svg)](https://results.pre-commit.ci/latest/github/angelo-peronio/nanonis-xarray/master)
[![codecov](https://codecov.io/github/angelo-peronio/nanonis-xarray/graph/badge.svg)](https://codecov.io/github/angelo-peronio/nanonis-xarray)
[![ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json)](https://github.com/astral-sh/ruff)

`nanonis_xarray` is a Python module to read spectroscopy measurements saved in text
format (`.dat`) by a [Nanonis Mimea](https://www.specs-group.com/nanonis/products/mimea/)
SPM control system from [SPECS Surface Nano Analysis GmbH](https://www.specs-group.com/).

The data is read into a [`xarray.Dataset`](https://docs.xarray.dev/en/stable/getting-started-guide/why-xarray.html#core-data-structures), where each measured quantity, such as tunnelling current or AFM oscillation amplitude, is a [`xarray.DataArray`](https://docs.xarray.dev/en/stable/user-guide/data-structures.html#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:

```python
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:

* [`nanonispy2`](https://github.com/ceds92/nanonispy2)
* [`xarray-nanonis`](https://github.com/John3859/xarray-nanonis)
* ... and [many more](https://pypi.org/search/?q=nanonis).
