hyperspy / hyperspy

Multidimensional data analysis
https://hyperspy.org
GNU General Public License v3.0
518 stars 210 forks source link

hs.load: specifying file reader #1478

Closed magnunor closed 4 years ago

magnunor commented 7 years ago

Currently HyperSpy supports two different types of HDF5-"standards":

In the future HyperSpy will (probably) also support the FEI HDF5 (emd) file format.

Since the emd files are valid HDF5 files, they sometimes have the hdf5-extension. So when trying to load a NCEM EMD/HDF5-file with the .hdf5 extension it fails. This is ok, but it would be nice to be able to specify the file reader you want HyperSpy to use, and pass this to the io.load_single_file function.

This works:

import hyperspy.io
emd_reader = hyperspy.io.io_plugins[9]
s = hyperspy.io.load_with_reader("an_emd_file.hdf5", emd_reader)
thomasaarholt commented 7 years ago

Is there anything in the hdf5 format that allows specification of what sort of file it is? Perhaps we could look for "emd", "hyperspy" etc in the file?