Dask API

LiberTEM can generate an efficient Dask array from data sets. See Load datasets as Dask arrays for details!

libertem.contrib.daskadapter.make_dask_array(dataset: DataSet, dtype='float32', roi=None, array_backend: Literal['numpy', 'numpy.matrix', 'cuda', 'cupy', 'sparse.COO', 'sparse.GCXS', 'sparse.DOK', 'scipy.sparse.coo_matrix', 'scipy.sparse.csr_matrix', 'scipy.sparse.csc_matrix', 'scipy.sparse.coo_array', 'scipy.sparse.csr_array', 'scipy.sparse.csc_array', 'cupyx.scipy.sparse.coo_matrix', 'cupyx.scipy.sparse.csr_matrix', 'cupyx.scipy.sparse.csc_matrix'] | None = None)[source]

Create a Dask array using the DataSet’s partitions as blocks.

Parameters:
  • dataset – The LiberTEM dataset to load from

  • dtype – The numpy dtype into which the data should be converted

  • roi – Restrict the dataset to this region of interest (nav-shaped mask)

  • array_backend – The array type the data should be converted to

Dask result buffer

class libertem.executor.utils.dask_buffer.DaskResultBufferWrapper(data, *args, **kwargs)[source]

A DaskBufferWrapper that is meant to be used for results.

In the LiberTEM internals, we need to make sure everything is still lazy/delayed.

Once we leave LiberTEM internals, the external interface is used, where both data() and raw_data() eagerly return numpy array-like objects.

property data

Eager version of delayed_data()

property delayed_data
property delayed_raw_data
classmethod from_buffer_wrapper(buffer: BufferWrapper)[source]
property raw_data

Eager version of delayed_raw_data()