# magni.afm.io._data_attachment module¶

Module providing functionality for attaching data.

The reading of an .mi file is logically separated into four steps of which the functionality provided by this module performs the third step.

## Routine listings¶

attach_data(obj, data)
Attach data to a hierarchical object-structure.
magni.afm.io._data_attachment.attach_data(obj, data)[source]

Attach data to a hierachical object-structure.

In the case of .mi image files, the data should be attached to the buffers of the file. In the case of .mi spectroscopy files, the data should be attached to the chunks of the file.

Parameters: obj (object) – The hierarchical object-structure to attach data to. data (numpy.ndarray) – The 1-dimensional data.

magni.afm.io.read_mi_file()
Function using the present function.
magni.afm.io._data_attachment._attach_image_data(obj, data)[source]

Attach data to a hierarchical object-structure representing an image.

The data should be attached to the buffers of the file.

Parameters: obj (object) – The hierarchical object-structure to attach data to. data (numpy.ndarray) – The 1-dimensional data.

attach_data()
Function using the present function.
magni.afm.io._data_attachment._attach_spectroscopy_data(obj, data)[source]

Attach data to a hierarchical object-structure representing a spectroscopy.

The data should be attached to the chunks of the file.

Parameters: obj (object) – The hierarchical object-structure to attach data to. data (numpy.ndarray) – The 1-dimensional data.

attach_data()
Function using the present function.
magni.afm.io._data_attachment._handle_format_inconsistency(obj, data)[source]

Handle format inconsistency.

The inconsistency is the optional precense of an undocumented thumbnail. If the thumbnail is present, the file header contains a thumbnail parameter specifying the resolution of the thumbnail image.

Parameters: obj (object) – The hierarchical object-structure to attach data to. data (numpy.ndarray) – The 1-dimensional data. obj (object) – The hierarchical object-structure to attach data to. data (numpy.ndarray) – The 1-dimensional data excluding any thumbnail data. thumbnail (list) – A list of a thumbnail object-structure if any.

_attach_image_data()