4.1.1.1.1.1. lib.data_handling.utilities
#
Utility function shared among the data_handling module. @author: Thomas Arne Hensel, 2023
4.1.1.1.1.1.1. Module Contents#
4.1.1.1.1.1.1.1. Classes#
Convert back and forth between different data formats, styles, and shapes. |
4.1.1.1.1.1.1.2. API#
- class lib.data_handling.utilities.Converter#
Convert back and forth between different data formats, styles, and shapes.
Methods: - __init__(): Constructor for the Converter class. - partition_record(record, block_size, seg_idcs=None, truncate=False): Partition an array into x and y-scans in the record. - partition_array(array, block_size, seg_idcs=None, truncate=False): Partition an array into x and y-scans. - join_array(array, block_size, seg_idcs=None, truncate=False): Join x and y-scans back into a single array.
Initialization
- partition_record(record, block_size, seg_idcs=None, truncate=False)#
Partition an array into x and y-scans in the record.
- Parameters:
record (Record) – Reshaped record that has to be partitioned into x-y axis.
block_size (int) – Size of the data block.
seg_idcs (tuple, optional) – Segment indices, defaults to None.
truncate (bool, optional) – Option to produce imarrays of equal length, defaults to False.
- Returns:
Partitioned record.
- Return type:
- partition_array(array, block_size, seg_idcs=None, truncate=False)#
Partition an array into x and y-scans.
- Parameters:
array (numpy.ndarray) – Array to be partitioned.
block_size (int) – Size of the data block.
seg_idcs (tuple, optional) – Segment indices, defaults to None.
truncate (bool, optional) – Option to produce imarrays of equal length, defaults to False.
- Returns:
List containing x and y arrays.
- Return type:
list of numpy.ndarray
- join_array(array, block_size, seg_idcs=None, truncate=False)#
Join x and y-scans back into a single array.
- Parameters:
array (list of numpy.ndarray) – List containing x and y arrays.
block_size (int) – Size of the data block.
seg_idcs (tuple, optional) – Segment indices, defaults to None.
truncate (bool, optional) – Option to produce imarrays of equal length, defaults to False.
- Returns:
Joined array.
- Return type:
numpy.ndarray
- reshape_record(experiment, export=False, show=False)#
Retrieve an image array from an experiment-object.
Creates a deep-copy of the record attribute of the experiment object, modifies the record, and returns it.
- Parameters:
experiment (Experiment) – Experiment object.
export (bool, optional) – Option to export to a tif file, defaults to False.
show (bool, optional) – Option to display the reshaped array, defaults to False.
- Returns:
Record object.
- Return type: