gsffile
is a Python library 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.
Install with pip
python -m pip install gsffile
or with conda
conda install gsffile
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")
gsffile
is documented via docstrings:
python -c "import gsffile; help(gsffile)"