magni.afm.io._stream_conversion module¶
Module providing functionality for converting a file stream.
The reading of an .mi file is logically separated into four steps of which the functionality provided by this module performs the first step.
Routine listings¶
- convert_stream(stream)
- Convert a file stream to flat, basic variables.
-
magni.afm.io._stream_conversion.
convert_stream
(stream)[source]¶ Convert a file stream to flat, basic variables.
The flat, basic variables are separated into header parameters and the data. The header parameters are name, value pairs whereas the data is a 1-dimensional numeric array.
Parameters: stream (str) – The file stream. Returns: - params (tuple) – The header parameters.
- data (numpy.ndarray) – The data.
See also
magni.afm.io.read_mi_file()
- Function using the present function.
Notes
This function splits the file stream into header and data, and splits the header into parameter name, value pairs.
-
magni.afm.io._stream_conversion.
_convert_image_data
(buffer_, data_type)[source]¶ Convert the file stream image data to a 1-dimensional numeric array.
Parameters: - buffer_ (str) – The file stream image data.
- data_type (str) – The data type of the file stream image data.
Returns: data (numpy.ndarray) – The data as a 1-dimensional numeric array.
See also
convert_stream()
- Function using the present function.
-
magni.afm.io._stream_conversion.
_convert_parameter_value
(string)[source]¶ Convert a file stream parameter value to a basic python value.
The converted value is either a boolean, string, floating point, or integer value or a list containing a mix of these.
Parameters: string (str) – The file stream parameter value. Returns: value (None) – The converted, basic python value. See also
convert_stream()
- Function using the present function.
-
magni.afm.io._stream_conversion.
_convert_spectroscopy_data
(buffer_, data_type)[source]¶ Convert the file stream spectroscopy data to a 1-dimensional numeric array.
Parameters: - buffer_ (str) – The file stream spectroscopy data.
- data_type (str) – The data type of the file stream spectroscopy data.
Returns: data (numpy.ndarray) – The data as a 1-dimensional numeric array.
See also
convert_stream()
- Function using the present function.