Catalog PyPI
Back to packageRELEASE DETAILS

0.0.7

PyPI

AFMReader

Read and retrieve data from various AFM file formats.

afmimageprocessing
Published26 Jan 2026
Direct dependencies24
Transitive dependenciesNot calculated

README

Version 0.0.7 documentation

AFMReader

PyPI version PyPI - Python Version Code style: Ruff Code style: black Code style: flake8

pre-commit.ci
status fair-software.eu

Downloads Downloads Downloads

A library for loading various Atomic Force Microscopy (AFM) file formats into Python. This library is primarily intended for use with TopoStats.

Supported file formats

File formatDescription
.asdHigh-speed AFM
.gwyGwydion
.h5-jpkBruker
.ibwWaveMetrics
.jpk-qi-imageBruker
.jpkBruker
.spmBruker's Format
.stpWSXM AFM software files
.top.stp variant
.topostatsTopoStats

Support for the following additional formats is planned. Some of these are already supported in TopoStats and are awaiting refactoring to move their functionality into AFMReader these are denoted in bold below.

File formatDescriptionStatus
.nhfNanosurfTo Be Implemented.
.arisImaris Oxford InstrumentsTo Be Implemented.
.tiffPark SystemsTo Be Implemented.

Usage

If you wish to process AFM images supported by AFMReader it is recommend you use TopoStats to do so, however the library can be used on its own.

.topostats

You can open .topostats files using the load_topostats function. Just pass in the path to the file.

from AFMReader.topostats import load_topostats

image, pixel_to_nanometre_scaling_factor, metadata = load_topostats(file_path="./my_topostats_file.topostats")

.spm

You can open .spm files using the load_spm function. Just pass in the path to the file and the channel name that you want to use. (If in doubt use one of the following: "Height", "ZSensor", "Height Sensor").

from AFMReader.spm import load_spm

image, pixel_to_nanometre_scaling_factor = load_spm(file_path="./my_spm_file.spm", channel="Height")

.gwy

You can open .gwy files using the load_gwy function. Just pass in the path to the file and the channel name that you want to use. (If in doubt use one one of the following: "Height", "ZSensor", "Height Sensor").

from AFMReader.gwy import load_gwy

image, pixel_to_nanometre_scaling_factor = load_gwy(file_path="./my_gwy_file.gwy", channel="Height")

.asd

You can open .asd files using the load_asd function. Just pass in the path to the file and the channel name that you want to use. (If in doubt use the "TP" topography channel).

Note: For .asd files, there seem to only ever be two channels in one file. "TP" (topography) is the main one you will want to use unless you know you specifically want something else.

Other channels: "ER" - Error, "PH" - Phase

from AFMReader.asd import load_asd

frames, pixel_to_nanometre_scaling_factor, metadata = load_asd(file_path="./my_asd_file.asd", channel="TP")

.ibw

You can open .ibw files using the load_ibw function. Just pass in the path to the file and the channel name that you want to use. (If in doubt, use HeightTracee (yes, with the extra 'e'), ZSensorTrace, or ZSensor).

from AFMReader.ibw import load_ibw

image, pixel_to_nanometre_scaling_factor = load_ibw(file_path="./my_ibw_file.ibw", channel="HeightTracee")

.jpk

You can open .jpk files using the load_jpk function. Just pass in the path to the file and the channel name you want to use. (If in doubt, use height_trace or measuredHeight_trace).

from AFMReader.jpk import load_jpk

image, pixel_to_nanometre_scaling_factor = load_jpk(file_path="./my_jpk_file.jpk", channel="height_trace")

.h5-jpk

You can open .h5-jpk files using the load_h5jpk function. Just pass in the path to the file and the channel name you want to use. (If in doubt, use height_trace or measuredHeight_trace).

Note: Since .h5-jpk stores timeseries AFM data a dictionary of timestamps for each frame is also returned.

from AFMReader.h5_jpk import load_h5jpk

frames, pixel_to_nanometre_scaling_factor, timestamp_dict = load_h5jpk(file_path="./my_jpk_file.jpk", channel="height_trace")

.stp

You can open .stp files using the load_stp function. Just pass in the path to the file you want to use.

from AFMReader.stp import load_stp

image, pixel_to_nanometre_scaling_factor = load_stp(file_path="./my_stp_file.stp")

.top

You can open .top files using the load_top function. Just pass in the path to the file you want to use.

from AFMReader.top import load_top

image, pixel_to_nanometre_scaling_factor = load_top(file_path="./my_top_file.top")

Contributing

Bug reports and feature requests are welcome. Please search for existing issues, if none relating to your bug/feature are found then feel free to create a new issue detailing what went wrong or the feature you would like to see implemented.

Pull requests are also welcome, please note that we have a Code of Conduct.

Setup

We use pre-commit to apply linting via ruff and pylint pre-commit hooks and use the Black and Flake8 code styles. To set yourself up for contributing after cloning the package and creating a Python virtual environment you should install the development dependencies and pre-commit as shown below.

# Activate your virtual environment, this will depend on which system you use e.g. conda or virtualenvwrapper
# Clone the repository
git clone git@github.com:AFM-SPM/AFMReader.git
# Change directories into the newly cloned directory
cd AFMReader
# Install the package along with the optional development (dev) dependencies
pip install -e .[dev]
# Install pre-commit
pre-commit install

This will ensure that any commits and pull requests you make will pass the Pre-commit Continuous Integration. Where possible ruff will correct the changes it can, but it may require you to address some issues manually, before adding any changes and attempting to commit again.

Citing

If you use or depend on AFMReader in your software please consider citing it in any derivative work that is published. Citation details can be found in the CITATION.cff file in this repository.

Also, please let us know if you use AFMReader in your software. You can either make a Pull Request to add it to the list below or you can email us at topostats@sheffield.ac.uk with details of your package.

Used By

AFMReader is a dependency of the following packages.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 26

Native requirements
24 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
h5py
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
h5pyruntime
igor2
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
igor2runtime
loguru
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
logururuntime
matplotlib
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
matplotlibruntime
pySPM
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pySPMruntime
tifffile
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
tifffileruntime
ruamel.yaml
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
ruamel.yamlruntime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
black; extra == "dev"runtime
pre-commit
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pre-commit; extra == "dev"runtime
pylint
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pylint; extra == "dev"runtime
pytest-testmon
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest-testmon; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
ruff; extra == "dev"runtime
setuptools_scm
Environment
{
  "extras": "toml",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
setuptools_scm[toml]; extra == "dev"runtime
wheel
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
wheel; extra == "dev"runtime
mike
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mike; extra == "docs"runtime
mkdocs
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mkdocs; extra == "docs"runtime
mkdocs-material
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mkdocs-material; extra == "docs"runtime
mkdocs-mermaid2-plugin
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mkdocs-mermaid2-plugin; extra == "docs"runtime
mkdocs-terminal
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mkdocs-terminal; extra == "docs"runtime
mkdocstrings
Environment
{
  "extras": "python",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
mkdocstrings[python]; extra == "docs"runtime
build
Environment
{
  "extras": "",
  "marker": "extra == \"pypi\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
build; extra == "pypi"runtime
setuptools_scm
Environment
{
  "extras": "toml",
  "marker": "extra == \"pypi\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
setuptools_scm[toml]; extra == "pypi"runtime
wheel
Environment
{
  "extras": "",
  "marker": "extra == \"pypi\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
wheel; extra == "pypi"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"tests\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest; extra == "tests"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"tests\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov; extra == "tests"runtime
pytest-loguru
Environment
{
  "extras": "",
  "marker": "extra == \"tests\"",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pytest-loguru; extra == "tests"runtime

Distribution files

2 collected
afmreader-0.0.7-py3-none-any.whl

bdist_wheel · 42.86 KB · Python py3

Source file
afmreader-0.0.7.tar.gz

sdist · 53,676.05 KB · Python source

Source file

Repository

PENDING
afm-spm/afmreader

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:09 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:80503ef888c51cfbcf482d13d92ee030ae2b014a041d53ec8c9309d76ee2530c

Other collected versions

View all collected versions →