Skip to content

angelo-peronio/gsffile

Repository files navigation

Read and write Gwyddion Simple Field files

pypi conda-forge pypi downloads license python ci pre-commit.ci status codecov ruff DOI

gsffile is a Python module to:

  • read image and metadata from Gwyddion Simple Field (.gsf) files, and
  • store NumPy arrays in Gwyddion Simple Field files.

It features type annotations, minimal logging, and an overgrown test suite.

Setup

Install with pip

python -m pip install gsffile

or with conda

conda install gsffile

Quickstart

>>> from gsffile import read_gsf, write_gsf
>>> import numpy as np

# The Gwyddion Simple Field format supports only 32-bit floating point data.
>>> data = np.eye(100, dtype=np.float32)

# Optional metadata.
>>> metadata = {
...    "XReal": 5e-05,
...    "YReal": 5e-05,
...    "XYUnits": "m",
...    "ZUnits": "V",
...    "CustomKey": 33,
...    }

>>> write_gsf("example.gsf", data, metadata)

>>> data, metadata = read_gsf("example.gsf")

Documentation

gsffile is documented via docstrings:

python -c "import gsffile; help(gsffile)"

How to cite

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

About

A Python module to read and write Gwyddion Simple Field files

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •