nanonis-xarray


Namenanonis-xarray JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryRead a Nanonis spectroscopy .dat file into a xarray Dataset
upload_time2025-10-11 19:13:12
maintainerNone
docs_urlNone
authorAngelo Peronio
requires_python>=3.11
licenseNone
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
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Xarray plugin to read Nanonis spectroscopy .dat files

[![pypi](https://img.shields.io/pypi/v/nanonis-xarray)](https://pypi.org/project/nanonis-xarray/)
[![conda-forge](https://img.shields.io/conda/vn/conda-forge/nanonis-xarray)](https://anaconda.org/conda-forge/nanonis-xarray)
[![pypi downloads](https://img.shields.io/pypi/dm/nanonis-xarray)](https://pypistats.org/packages/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/)
[![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)
[![SPEC 0 — Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)
[![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)
[![DOI](https://zenodo.org/badge/1032126987.svg)](https://doi.org/10.5281/zenodo.17095214)

`nanonis-xarray` is a [`xarray`](https://xarray.dev/) plugin 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 channel (tunnelling current, 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 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.

```python
>>> 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) int64 24B 1 2 3
  * direction  (direction) object 16B 'bw' 'fw'

```

[`pint-xarray`](https://xarray.dev/blog/introducing-pint-xarray) is used to associate a physical unit to each channel, unless `xr.open_dataset()` is called with `quantify_vars=False`:

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

```

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

```python
>>> data.attrs["Z Spectroscopy"]["Number of sweeps"]
3
>>> data.attrs["Z Spectroscopy"]["backward sweep"]
True

```

Physical quantities are stored as [`pint.Quantity`](https://pint.readthedocs.io/en/stable/getting/tutorial.html#defining-a-quantity), timestamps as [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime-objects), and paths as [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#basic-use):

```python
>>> data.attrs["NanonisMain"]["RT Frequency"]
<Quantity(10000.0, 'hertz')>
>>> data.attrs["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:

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

## How to cite

Cite `nanonis-xarray` in your published work using the metadata in [`CITATION.cff`](CITATION.cff).
Specific DOIs and BibTeX entries for each released version can be found on [Zenodo](https://doi.org/10.5281/zenodo.17095214).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nanonis-xarray",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "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",
    "author": "Angelo Peronio",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c6/a7/5817382db8c4504d4c186f4136d9ea7678c8bef8ee37293dc00cf4366147/nanonis_xarray-0.1.7.tar.gz",
    "platform": null,
    "description": "# Xarray plugin to read Nanonis spectroscopy .dat files\n\n[![pypi](https://img.shields.io/pypi/v/nanonis-xarray)](https://pypi.org/project/nanonis-xarray/)\n[![conda-forge](https://img.shields.io/conda/vn/conda-forge/nanonis-xarray)](https://anaconda.org/conda-forge/nanonis-xarray)\n[![pypi downloads](https://img.shields.io/pypi/dm/nanonis-xarray)](https://pypistats.org/packages/nanonis-xarray)\n[![license](https://img.shields.io/github/license/angelo-peronio/nanonis-xarray)](https://github.com/angelo-peronio/nanonis-xarray/blob/master/LICENSE)\n[![python](https://img.shields.io/pypi/pyversions/nanonis-xarray)](https://pypi.org/project/nanonis-xarray/)\n[![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)\n[![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)\n[![codecov](https://codecov.io/github/angelo-peronio/nanonis-xarray/graph/badge.svg)](https://codecov.io/github/angelo-peronio/nanonis-xarray)\n[![SPEC 0 \u2014 Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)\n[![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)\n[![DOI](https://zenodo.org/badge/1032126987.svg)](https://doi.org/10.5281/zenodo.17095214)\n\n`nanonis-xarray` is a [`xarray`](https://xarray.dev/) plugin to read spectroscopy measurements saved in text\nformat (`.dat`) by a [Nanonis Mimea](https://www.specs-group.com/nanonis/products/mimea/)\nSPM control system from [SPECS Surface Nano Analysis GmbH](https://www.specs-group.com/).\n\nThe 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 channel (tunnelling current, AFM oscillation amplitude, \u2026) is a [`xarray.DataArray`](https://docs.xarray.dev/en/stable/user-guide/data-structures.html#dataarray) with up to three dimensions:\n\n* The independent variable of the measurement, such as sample bias voltage or tip z position;\n* The sweep number, if the measurement has been repeated multiple times;\n* The sweep direction (forward or backward), if the independent variable has been swept in both directions.\n\n```python\n>>> import xarray as xr\n\n>>> data = xr.open_dataset(\"tests/data/z.dat\")\n>>> data.coords\nCoordinates:\n  * z_rel      (z_rel) float64 2kB [m] -2.1e-10 -2.065e-10 ... 4.865e-10 4.9e-10\n  * sweep      (sweep) int64 24B 1 2 3\n  * direction  (direction) object 16B 'bw' 'fw'\n\n```\n\n[`pint-xarray`](https://xarray.dev/blog/introducing-pint-xarray) is used to associate a physical unit to each channel, unless `xr.open_dataset()` is called with `quantify_vars=False`:\n\n```python\n>>> data[\"current\"].pint.units\n<Unit('ampere')>\n\n```\n\nThe header of the measurement is stored in the `attrs` nested dictionary:\n\n```python\n>>> data.attrs[\"Z Spectroscopy\"][\"Number of sweeps\"]\n3\n>>> data.attrs[\"Z Spectroscopy\"][\"backward sweep\"]\nTrue\n\n```\n\nPhysical quantities are stored as [`pint.Quantity`](https://pint.readthedocs.io/en/stable/getting/tutorial.html#defining-a-quantity), timestamps as [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime-objects), and paths as [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#basic-use):\n\n```python\n>>> data.attrs[\"NanonisMain\"][\"RT Frequency\"]\n<Quantity(10000.0, 'hertz')>\n>>> data.attrs[\"Date\"]\ndatetime.datetime(2015, 3, 27, 11, 49, 5)\n\n```\n\n## \ud83d\udea7 Work in progress \ud83d\udea7\n\nThis library is under development: expect breaking changes. Nanonis binary formats (`.sxm`, `.3ds`) are currently not supported, and can be read by similar projects:\n\n* [`nanonispy2`](https://github.com/ceds92/nanonispy2)\n* [`xarray-nanonis`](https://github.com/John3859/xarray-nanonis)\n* ... and [many more](https://pypi.org/search/?q=nanonis).\n\n## How to cite\n\nCite `nanonis-xarray` in your published work using the metadata in [`CITATION.cff`](CITATION.cff).\nSpecific DOIs and BibTeX entries for each released version can be found on [Zenodo](https://doi.org/10.5281/zenodo.17095214).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Read a Nanonis spectroscopy .dat file into a xarray Dataset",
    "version": "0.1.7",
    "project_urls": {
        "Issues": "https://github.com/angelo-peronio/nanonis-xarray/issues",
        "Repository": "https://github.com/angelo-peronio/nanonis-xarray"
    },
    "split_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"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f76938aa8a3ca64f35090a76e160ba0374702054371f6108e4d5bdd3c27f0be6",
                "md5": "d6f76a18e435e80407e1567fc5545eed",
                "sha256": "e31275a3e5caab22bf5875625b9add664bfcfe78a4e989b53f54ac11c2c9c791"
            },
            "downloads": -1,
            "filename": "nanonis_xarray-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6f76a18e435e80407e1567fc5545eed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 9469,
            "upload_time": "2025-10-11T19:13:11",
            "upload_time_iso_8601": "2025-10-11T19:13:11.667873Z",
            "url": "https://files.pythonhosted.org/packages/f7/69/38aa8a3ca64f35090a76e160ba0374702054371f6108e4d5bdd3c27f0be6/nanonis_xarray-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c6a75817382db8c4504d4c186f4136d9ea7678c8bef8ee37293dc00cf4366147",
                "md5": "dc6253e0cab44037577d45b7280f981a",
                "sha256": "44bcd5187a37aea497bbcf0b1b684df73a762674fa20df733397600e8955ee1c"
            },
            "downloads": -1,
            "filename": "nanonis_xarray-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "dc6253e0cab44037577d45b7280f981a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 102240,
            "upload_time": "2025-10-11T19:13:12",
            "upload_time_iso_8601": "2025-10-11T19:13:12.983680Z",
            "url": "https://files.pythonhosted.org/packages/c6/a7/5817382db8c4504d4c186f4136d9ea7678c8bef8ee37293dc00cf4366147/nanonis_xarray-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-11 19:13:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "angelo-peronio",
    "github_project": "nanonis-xarray",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nanonis-xarray"
}
        
Elapsed time: 2.52379s