nxtomomill.utils.utils.add_dark_flat_nx_file#
- nxtomomill.utils.utils.add_dark_flat_nx_file(file_path, entry, darks_start=None, flats_start=None, darks_end=None, flats_end=None, extras=None, logger=None, embed_data=False)[source]#
This will get all data from entry@input_file and patch them with provided dark and / or flat(s). We consider the sequence as: dark, start_flat, projections, end_flat.
Behavior regarding data type and target dataset:
- if dataset at entry already exists:
- if dataset at entry is a ‘standard’ dataset:
data will be loaded if necessary and enrty will be updated
- if dataset at entry is a virtual dataset:
if data is a numpy array then we raise an error: the data should already be saved somewhere and you should provide a DataUrl
if data is a DataUrl then the virtual dataset is updated and a virtual source pointing to the DataUrl.file_path()@DataUrl.data_path() is added to the layout
- if a new dataset entry need to be added:
if data is a numpy array then we create a new ‘standard’ Dataset
if data is a DataUrl then a new virtual dataset will be created
note: Datasets image_key, image_key_control, rotation_angle and count_time will be copied each time.
- Parameters
file_path – NXTomo file containing data to be patched
entry – entry to be patched
darks_start – (3D) numpy array containing the first dark serie if any
flats_start – (3D) numpy array containing the first flat if any
darks_end – (3D) numpy array containing dark the second dark serie if any
flats_end – (3D) numpy array containing the second flat if any
extras – dictionary to specify some parameters for flats and dark like rotation angle. valid keys: ‘start_dark’, ‘end_dark’, ‘start_flag’, ‘end_flag’. Values should be a dictionary of ‘NXTomo’ keys with values to be set instead of ‘default values’. Possible values are: * count_time * rotation_angle
logger – object for logs
embed_data – if True then each external data will be copy under a ‘duplicate_data’ folder