ptyrad.io.load

Contents

ptyrad.io.load#

PtyRAD-specific loading function

Functions

load_ptyrad(file_path)

Load PtyRAD reconstruction files based on their file extension.

ptyrad.io.load.load_ptyrad(file_path)[source]#

Load PtyRAD reconstruction files based on their file extension.

This function supports loading files with extensions .h5, .hdf5, and .pt. The file type is inferred from the extension, and the appropriate loader function is called. The suggested model output file type has changed to HDF5 since PtyRAD v0.1.0b7 for cross-platform interoperability.

Parameters:

file_path (str) – Path to the file to be loaded.

Returns:

The loaded data, typically as a numpy array or dictionary, depending on the file type.

Return type:

Any

Raises:
  • FileNotFoundError – If the specified file does not exist.

  • ValueError – If the file type is unsupported.

Notes

  • .h5 and .hdf5 files are loaded using the load_hdf5 function.

  • .pt files are loaded using the load_pt function and converted to numpy arrays for backward compatibility.

  • Unsupported file types will raise a ValueError.

Example

`python data = load_ptyrad("example.h5") `