nabu.io.reader_helical module

class nabu.io.reader_helical.ChunkReaderHelical(files, sub_region=None, detector_corrector=None, pre_allocate=True, data_buffer=None, convert_float=False, shape=None, dtype=None, binning=None, dataset_subsampling=None, num_threads=None)[source]

Bases: ChunkReader

implements reading by projections subsets

Initialize a “ChunkReader”. A chunk is a stack of images.

Parameters:
  • files (dict) – Dictionary where the key is the file/data index, and the value is a silx.io.url.DataUrl pointing to the data. The dict must contain only the files which shall be used ! Note: the shape and data type is infered from the first data file.

  • sub_region (tuple, optional) – If provided, this must be a tuple in the form (start_x, end_x, start_y, end_y). Each image will be cropped to this region. This is used to specify a chunk of files. Each of the parameters can be None, in this case the default start and end are taken in each dimension.

  • pre_allocate (bool) – Whether to pre-allocate data before reading.

  • data_buffer (array-like, optional) – If pre_allocate is set to False, this parameter has to be provided. It is an array-like object which will hold the data.

  • convert_float (bool) – Whether to convert data to float32, regardless of the input data type.

  • shape (tuple, optional) – Shape of each image. If not provided, it is inferred from the first image in the collection.

  • dtype (numpy.dtype, optional) – Data type of each image. If not provided, it is inferred from the first image in the collection.

  • binning (int or tuple of int, optional) – Whether to bin the data. If multi-dimensional binning is done, the parameter must be in the form (binning_x, binning_y). Each image will be binned by these factors.

  • dataset_subsampling (int, optional) – Whether to subsample the dataset. If an integer n is provided, then one image out of n will be read.

  • num_threads (int, optional) – Number of threads to use for binning the data. Default is to use all available threads. This parameter has no effect when binning is disabled.

Notes

The files are provided as a collection of silx.io.DataURL. The file type is inferred from the extension.

Binning is different from subsampling. Using binning will not speed up the data retrieval (quite the opposite), since the whole (subregion of) data is read and then binning is performed.

set_data_buffer(data_buffer, pre_allocate=False)[source]
get_binning()[source]
load_files(overwrite: bool = False, sub_total_prange_slice=slice(None, None, None))[source]

Load the files whose links was provided at class instantiation.

Parameters:

overwrite (bool, optional) – Whether to force reloading the files if already loaded.

load_data(overwrite: bool = False, sub_total_prange_slice=slice(None, None, None))

Load the files whose links was provided at class instantiation.

Parameters:

overwrite (bool, optional) – Whether to force reloading the files if already loaded.

property data