JPK Modules
For decoding and loading .jpk AFM file format into Python Numpy arrays.
get_jpk_channels(file_path: Path | str, config_path: Path | str | None = None) -> dict[str, int]
Get the list of channels available in the .jpk file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path | str
|
Path to the .jpk file. |
required |
config_path
|
Path | str | None
|
Path to a configuration file. If ''None'' (default) then the packages default configuration is loaded from ''default_config.yaml''. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str]
|
Dictionary of available channels. |
Source code in AFMReader/jpk.py
load_jpk(file_path: Path | str, channel: str, config_path: Path | str | None = None, flip_image: bool = True) -> AFMScan
Load image from JPK Instruments .jpk files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
Path | str
|
Path to the .jpk file. |
required |
channel
|
str
|
The channel to extract from the .jpk file. |
required |
config_path
|
Path | str | None
|
Path to a configuration file. If ''None'' (default) then the packages default configuration is loaded from ''default_config.yaml''. |
None
|
flip_image
|
bool
|
Whether to flip the image vertically. Default is |
True
|
Returns:
| Type | Description |
|---|---|
AFMScan
|
An AFMScan object containing the image, its pixel to nanometre scaling value, and z-axis units. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file is not found. |
KeyError
|
If the channel is not found in the file. |
Examples:
Load height trace channel from the .jpk file. 'height_trace' is the default channel name.
>>> from AFMReader.jpk import load_jpk
>>> afm_scan = load_jpk(file_path="./my_jpk_file.jpk", channel="height_trace", flip_image=True)
>>> image = afm_scan.image
>>> pixel_to_nanometre_scaling_factor = afm_scan.pixel_to_nanometre_scaling
>>> z_units = afm_scan.z_units