load_ND_with_key

load_ND_with_key#

ptyrad.load.load_ND_with_key(file_path, key=None, ndims=None, verbose=True)[source]#

Load exactly one ND dataset from (possibly nested) files like .mat and .hdf5.

Parameters:
  • file_path (str) – Path to the file.

  • key (str, optional) – Key to specify the dataset. If not provided, will search for all valid ND datasets.

  • ndims (list) – List of desired dimensions for filtering datasets.

  • verbose (bool) – Whether to print information about the datasets.

Returns:

The loaded dataset.

Return type:

numpy.ndarray

Raises:

ValueError – If the file type is unsupported, or the key is invalid, or multiple/zero valid datasets are found.