afmformats.formats.fmt_jpk.jpk_reader

Classes

class afmformats.formats.fmt_jpk.jpk_reader.ArchiveCache[source]

Archive cache for fast access to zip data

If every JPKReader has its own instance of ZipFile, then on macOS (and possibly other OSes), we might run into an OSError; [Errno 24] Too many open files (https://github.com/AFM-analysis/afmformats/issues/10). The problem is, that if we don’t leave the ZipFile, we have to re-open it every time we want to access some data. This is a huge overhead.

The solution is ArchiveCache, which keeps a reference to the last max_archives=32 archives and closes the ones that were used least.

Inheritance

Inheritance diagram of ArchiveCache
static get(zip_path)[source]

Return the (possibly cached) ZipFile object for zip_path

class afmformats.formats.fmt_jpk.jpk_reader.JPKReader(path)[source]

Inheritance

Inheritance diagram of JPKReader
get_data(column, index, segment=None)[source]

Return data for a given column, index, or segment

Parameters
Returns

data – Column data

Return type

1d ndarray

get_index_numbers()[source]

Return int array with available index numbers

The numbers is what we refer to as “enum” in afmformats. Sometimes individual curves are missing from JPK files. These have to be correctly indexed.

get_index_path(index)[source]

Return the path in the zip file for a specific curve index

get_index_segment_numbers(index)[source]

Return available segment numbers for an index

get_index_segment_path(index, segment)[source]

Return the path in the zip file for a specific index and segment

get_metadata(index, segment=None)[source]

Return the metadata for a specific index and segment

Parameters
  • index (int) – Curve index; For “single” hierarchy files, this should be 0.

  • segment (int or None) – If None, then all segment-specific properties (e.g. approach and retract) are returned.

set_metadata(metadata)[source]

Override internal metadata

This has a direct effect on get_metadata().

property files

List of files and folders in the archive

property hierarchy

Format hierarchy (“single” or “indexed”)