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.api.load(), the correct reader needs to be
specified using the file_format parameter, because different .xml
formats are supported in rosettasciio and the reader will not be
selected automatically. For example:
>>> import hyperspy.api as hs
>>> sig = hs.load("file.xml", file_format="EMPAD")
API functions#
- rsciio.empad.file_reader(filename, lazy=False, q_calibration=None, remove_nans=False)#
Read file format used by the Electron Microscope Pixel Array Detector (EMPAD).
- Parameters:
- filename
str,pathlib.Path Filename of the file to read or corresponding pathlib.Path.
- lazybool, 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.- q_calibration
Noneorfloat, optional Specifies the calibration for the diffraction patterns in 1/nm. In EMPAD version v1.2.2 (default version shipped with most of the TFS TEMs), diffraction space calibration is no longer stored in the XML. Use this option to calibrate the diffraction patterns in 1/nm. If None, the data will be in pixel scales.
- remove_nansbool, optional
Sometimes the EMPAD data contains NaN values that cause issues in downstream processing. If True, these NaN values will be replaced with zeros. Default is False.
- filename
- Returns:
listofdictList of dictionaries containing the following fields:
‘data’ – multidimensional
numpy.ndarrayordask.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.
Notes
For EMPAD file v1.2.0+, the diffraction space calibration is no longer stored in the XML. The
q_calibrationparameter can be used to set the diffraction space calibration in 1/nm.Examples
>>> from rsciio.empad import file_reader >>> s = file_reader("empad_file.xml", q_calibration=0.3315)