https://github.com/angelo-peronio/gsffile
A Python module to read and write Gwyddion Simple Field files
https://github.com/angelo-peronio/gsffile
gsf gwyddion gwyddion-simple-field numpy python
Last synced: 9 months ago
JSON representation
A Python module to read and write Gwyddion Simple Field files
- Host: GitHub
- URL: https://github.com/angelo-peronio/gsffile
- Owner: angelo-peronio
- License: mit
- Created: 2024-06-28T12:29:32.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-09-29T19:27:55.000Z (9 months ago)
- Last Synced: 2025-09-29T21:32:48.097Z (9 months ago)
- Topics: gsf, gwyddion, gwyddion-simple-field, numpy, python
- Language: Python
- Homepage:
- Size: 315 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# Read and write Gwyddion Simple Field files
[](https://pypi.org/project/gsffile/)
[](https://anaconda.org/conda-forge/gsffile)
[](https://pypistats.org/packages/gsffile)
[](https://github.com/angelo-peronio/gsffile/blob/master/LICENSE)
[](https://pypi.org/project/gsffile/)
[](https://github.com/angelo-peronio/gsffile/actions/workflows/ci.yaml)
[](https://results.pre-commit.ci/latest/github/angelo-peronio/gsffile/master)
[](https://codecov.io/github/angelo-peronio/gsffile)
[](https://docs.astral.sh/ruff/)
[](https://doi.org/10.5281/zenodo.16998022)
`gsffile` is a Python module to:
* read image and metadata from [Gwyddion Simple Field](http://gwyddion.net/documentation/user-guide-en/gsf.html) (.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`
```bash
python -m pip install gsffile
```
or with `conda`
```bash
conda install gsffile
```
## Quickstart
```python
>>> 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:
```bash
python -c "import gsffile; help(gsffile)"
```
## How to cite
Cite `gsffile` 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.16998022).