pyxem / kikuchipy

Toolbox for analysis of electron backscatter diffraction (EBSD) patterns
https://kikuchipy.org
GNU General Public License v3.0
78 stars 30 forks source link

Reading of master patterns generated with EDAX #662

Open hakonanes opened 8 months ago

hakonanes commented 8 months ago

I've received a master pattern file generated with EDAX OIM Matrix from a colleague. It's a binary file with file extension .oem of 157.3 MB (157 286 400 bytes). I know nothing of the contents of the file, but I assume it contains master patterns of nickel, possibly for more than one beam energy. Thus, I cannot create a reader for it for kikuchipy at the moment.

@IMBalENce, you have access to EDAX OIM Matrix, right? Are you familiar with .oem files and their contents?

I'll leave this issue open if anyone with more information on this file format stumbles upon kikuchipy.

IMBalENce commented 8 months ago

@hakonanes Yes, we do have EDAX OIM Matrix. But I have not used the .oem format yet. I'll take a look to see if I can find any clue.

hakonanes commented 8 months ago

Hm, I remember you saying that they are stored as HDF5 files identical to EMsoft's HDF5 files, right?

IMBalENce commented 8 months ago

Just confirmed .oem format is actually a hdf5 compatible format, I can use the HDFview package to browser the data structure.

And h5py also works:

import h5py as h5

with h5.File(file) as oem:
    print(oem.keys())

<KeysViewHDF5 ['CrystalData', 'EMData', 'EMheader', 'ExperimentalPatterns', 'NMLparameters']>

I have been using the hdf5 master pattern generated from EMsoft in OIM Matrix without any issue, but have not generate any in OIM yet. Based on facts that OIM Matrix seems can get confused by the EMsoft document/.config/EMsoftConfig.json file, and there are several files in the OIM bin folder resemble the EMsoft equivalent files. There is a good chance that OIM Matrix is simply accessing the EMsoft modules through Fortran wrapper. So file format should be the same.

hakonanes commented 8 months ago

Aha, thank you for checking! I should of course have checked this myself.

Unless EDAX makes any significant changes to the way they write master pattern HDF5 files compared to the EMsoft way, we should be able to include the "oem" extension in https://github.com/pyxem/kikuchipy/blob/243ec481f04c3b8b5de67e4d8662d4f5ddb766a0/kikuchipy/io/plugins/emsoft_ebsd_master_pattern.py#L39