afmformats.formats.fmt_jpk.jpk_reader
Classes
ArchiveCache: Archive cache for fast access to zip dataJPKReader: Undocumented.
- class afmformats.formats.fmt_jpk.jpk_reader.ArchiveCache[source]
Archive cache for fast access to zip data
If every
JPKReaderhas 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
digraph inheritancee2a50e7ca7 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ArchiveCache" [URL="#afmformats.formats.fmt_jpk.jpk_reader.ArchiveCache",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Archive cache for fast access to zip data"]; }
- class afmformats.formats.fmt_jpk.jpk_reader.JPKReader(path)[source]
Inheritance
digraph inheritancecddfbc627e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "JPKReader" [URL="#afmformats.formats.fmt_jpk.jpk_reader.JPKReader",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }- get_data(column, index, segment=None)[source]
Return data for a given column, index, or segment
- Parameters:
column (str) – Valid column from
afmformats.afm_data.known_columnsindex (int) – Curve index in the current archive
segment (int or None) – Segment index for chosen curve index
- 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_segment_path(index, segment)[source]
Return the path in the zip file for a specific index and segment
- 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”)