SPM Modules
For decoding and loading .spm AFM file format into Python Numpy arrays.
load_spm(file_path, channel)
Extract image and pixel to nm scaling from the Bruker .spm file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
Path or str
|
Path to the .spm file. |
required |
channel
|
str
|
Channel name to extract from the .spm file. |
required |
Returns:
Type | Description |
---|---|
tuple(ndarray, float)
|
A tuple containing the image and its pixel to nanometre scaling value. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the file is not found. |
ValueError
|
If the channel is not found in the .spm file. |
Examples:
Load the image and pixel to nanometre scaling factor, available channels are 'Height', 'ZSensor' and 'Height Sensor'.
>>> from AFMReader.spm import load_spm
>>> image, pixel_to_nm = load_spm(file_path="path/to/file.spm", channel="Height")
```
Source code in AFMReader/spm.py
spm_pixel_to_nm_scaling(filename, channel_data)
Extract pixel to nm scaling from the SPM image metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
File name. |
required |
channel_data
|
SPM_image
|
Channel data from PySPM. |
required |
Returns:
Type | Description |
---|---|
float
|
Pixel to nm scaling factor. |