Skip to main content
`Ctrl`+`K`

# EMPAD format (XML & RAW)

This is the file format used by the Electron Microscope Pixel Array Detector (EMPAD). It is used to store a series of diffraction patterns from scanning transmission electron diffraction measurements, with a limited set of metadata. Similarly, to the ripple format, the raw data and metadata are saved in two different files and for the EMPAD reader, these are saved in the `.raw` and `.xml` files, respectively. To read EMPAD data, use the `.xml` file, which will automatically read the raw data from the `.raw` file too. The filename of the `.raw` file is defined in the `.xml` file, which implies changing the file name of the `.raw` file will break reading the file.

Note

When using HyperSpy, you need to specify the correct `reader` plugin, as different `.xml` formats are supported:

    >>> import hyperspy.api as hs
    >>> sig = hs.load("file.xml", reader="EMPAD")

## API functions

rsciio.empad.file_reader(filename, lazy=False)

  Read file format used by the Electron Microscope Pixel Array Detector (EMPAD).

  Parameters:
    filename `python:str`, `pathlib.Path`

      Filename of the file to read or corresponding pathlib.Path.

    lazy bool, default=False

      Whether to open the file lazily or not. The file will stay open until closed in `compute()` or closed manually. `get_file_handle()` can be used to access the file handler and close it manually.

  Returns:
    `python:list` of `python:dict`

      List of dictionaries containing the following fields:

      - ‘data’ – multidimensional `numpy.ndarray` or `dask.array.Array`

      - ‘axes’ – list of dictionaries describing the axes containing the fields ‘name’, ‘units’, ‘index_in_array’, and either ‘size’, ‘offset’, and ‘scale’ or a numpy array ‘axis’ containing the full axes vector

      - ‘metadata’ – dictionary containing the parsed metadata

      - ‘original_metadata’ – dictionary containing the full metadata tree from the input file

      When the file contains several datasets, each dataset will be loaded as separate dictionary.