magni.afm.io._object_building module¶
Module providing functionality for building a hierarchical object-structure.
The reading of an .mi file is logically separated into four steps of which the functionality provided by this module performs the second step.
Routine listings¶
- build_object(params)
- Build a hierarchical object-structure from header parameters.
-
magni.afm.io._object_building.build_object(params)[source]¶ Build a hierarchical object-structure from header parameters.
The hierarchical object-structure mimics that of
magni.afm.types.Parameters: params (list or tuple) – The header parameters. Returns: obj (object) – A hierarchical object-structure. See also
magni.afm.io.read_mi_file()- Function using the present function.
Notes
This function splits the header parameters into file-related parameters and buffer-related parameters.
-
magni.afm.io._object_building._build_buffer(file_type, index, params)[source]¶ Build a buffer-like object-structure from buffer parameters.
For spectroscopy buffers, this function converts parameters which contain “sub-parameters” to objects with attributes.
Parameters: - file_type (str) – The .mi file type.
- index (int) – The index of the buffer.
- params (list or tuple) – The buffer parameters.
Returns: obj (object) – The buffer-like object-structure.
See also
build_object()- Function using the present function.
-
magni.afm.io._object_building._expand_buffers(buffers)[source]¶ Expand the buffer-like object-structures.
Grid parameters specify implicit point parameters. Furthermore, some chunk parameters may be implicitly specified. These implicit parameters should be made explicit.
Parameters: buffers (list or tuple) – The buffer-like object-structures. See also
build_object()- Function using the present function.
_generate_grid_points()- Make implicit point parameters explicit.
_generate_implicit_chunks()- Make implicit chunk parameters explicit.
Notes
This function relies on the two functions,
_generate_grid_pointsand_generate_implicit_chunksto make the implicit parameters explicit.
-
magni.afm.io._object_building._generate_grid_points(attrs, index)[source]¶ Make implicit grid point parameters explicit.
Parameters: - attrs (list or tuple) – The attributes of the grid.
- index (int) – The index of the first grid point.
Returns: points (tuple) – The grid points.
See also
_expand_buffers()- Function using the present function.
-
magni.afm.io._object_building._generate_implicit_chunks(npoints, explicit_chunks)[source]¶ Make implicit chunk parameters explicit.
Parameters: - npoints (int) – The number of points.
- explicit_chunks (list) – The explicit chunks.
Returns: chunks (list) – The chunks including both explicit and implicit chunks.
See also
_expand_buffer()- Function using the present function.
-
magni.afm.io._object_building._handle_format_inconsistency(obj)[source]¶ Handle format inconsistency.
The inconsistency is the usage of string values for the ‘trace’ header parameter which is specified to have a boolean value.
Parameters: obj (object) – The hierarchical object-structure. Returns: obj (object) – The updated hierarchical object-structure. See also
build_object()- Function using the present function.