Skip to main content

gwyfile

https://img.shields.io/pypi/v/gwyfile.svg https://img.shields.io/pypi/l/gwyfile.svg https://img.shields.io/pypi/wheel/gwyfile.svg https://img.shields.io/pypi/pyversions/gwyfile.svg

A pure Python interface to reading and writing Gwyddion files.

Installation

$ pip install gwyfile

Usage

At the heart of this module is the GwyObject class, derived from collections.OrderedDict. Gwyddion files are just serialized copies of GwyObjects and its subclasses (GwyContainer, GwyDataField, …).

Here is a simple example that shows how to load a file and display a data channel:

import gwyfile

# Load a Gwyddion file into memory
obj = gwyfile.load('test.gwy')
# Return a dictionary with the datafield titles as keys and the
# datafield objects as values.
channels = gwyfile.util.get_datafields(obj)
channel = channels['Test']
# Datafield objects have a `data` property to access their
# two-dimensional data as numpy arrays.
data = channel.data

# Plot the data using matplotlib.
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.imshow(data, interpolation='none', origin='upper',
        extent=(0, channel.xreal, 0, channel.yreal))
plt.show()

It is also possible to manipulate and save objects:

import numpy as np
from gwyfile.objects import GwyContainer, GwyDataField
obj = GwyContainer()
obj['/0/data/title'] = 'Noise'
data = np.random.normal(size=(256, 256))
obj['/0/data'] = GwyDataField(data)
obj.tofile('noise.gwy')

The Gwyddion manual has a nice description of the file format. See there for further information on object properties.

Status

GwyObject serialization and deserialization should be complete. There are specialized subclasses for GwyDataField and GwySIUnit, but other convenience wrappers e.g. for GwyBrick are missing.

License

This project is licensed under the MIT license. See LICENSE.rst for details.

© 2014-17 Tino Wagner

Metadata

Release files for pycroscopy-gwyfile 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycroscopy-gwyfile 1.0.2
File Size Uploaded Provenance Actions
pycroscopy_gwyfile-1.0.2.tar.gz 23.8 kB Without provenance Details for pycroscopy_gwyfile-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycroscopy-gwyfile 1.0.2
File Interpreter ABI Platform Actions
pycroscopy_gwyfile-1.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for pycroscopy_gwyfile-1.0.2-py2.py3-none-any.whl

Total release size: 31.9 kB

Release files / pycroscopy_gwyfile-1.0.2.tar.gz

Download URL pycroscopy_gwyfile-1.0.2.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
11cd3f44ee0bd341bdbd5ac96df73679c0f07ed8759322cafbd6b22e170824f6
BLAKE2b-256 checksum
How to use checksums
b95676858cd18b4cc1467afa706dea7e4270db6625524dd82b779e062e069ca7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / pycroscopy_gwyfile-1.0.2-py2.py3-none-any.whl

Download URL pycroscopy_gwyfile-1.0.2-py2.py3-none-any.whl
Size 8.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ffa57c501769efcfb387b76bf3f301945a162df759503027308bf70c3283291d
BLAKE2b-256 checksum
How to use checksums
3e0793928e5945cd1a821fd10abc93173dc560635f68ff710716565c416f962c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for pycroscopy-gwyfile 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page