Skip to main content

Read and retrieve data from various AFM file formats.

Project description

AFMReader

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

pre-commit.ci status

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 format Description
.asd High-speed AFM
.ibw WaveMetrics
.spm Bruker's Format
.jpk Bruker

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 format Description Status
.gwy Gwyddion TopoStats supported, to be migrated (#1).
.nhf Nanosurf To Be Implemented.
.aris Imaris Oxford Instruments To Be Implemented.
.tiff Park Systems To 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.

.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")

.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")

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afmreader-0.0.1.tar.gz (44.2 MB view details)

Uploaded Source

Built Distribution

AFMReader-0.0.1-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file afmreader-0.0.1.tar.gz.

File metadata

  • Download URL: afmreader-0.0.1.tar.gz
  • Upload date:
  • Size: 44.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for afmreader-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2a9fdce027188cd984ca228cc76f064d64c5e36dee39ccf116fc299132a2fcef
MD5 124d27bbff31dbdf22a168add7736ee2
BLAKE2b-256 f9c6ac9420236249ec671d7823c2109d63d17760329e52b0d375d98d105f3aca

See more details on using hashes here.

File details

Details for the file AFMReader-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: AFMReader-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for AFMReader-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 516640efb8f2609afe8ddfb911e64a50e284be70f9f57e48ddb39be82242beb0
MD5 0748d603f40bd0ad6717a9561d4aeceb
BLAKE2b-256 099ea50613300932b51ccc353b175a50ba622a38bbc9cb9fcac602fd19508d77

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page