Closed AlexCarruthers1 closed 2 years ago
No need to apoligise! In general I think it's best to discuss bugs in GitHub issues rather than email because others can participate and it might be that others encounter your problem and thus find the solution here.
The error is raised because kikuchipy can't find a suitable file reader for your file.
Since kikuchipy supports reading HDF5 files produced from various software (EDAX TSL, Bruker Nano, EMsoft's EMEBSD and master pattern files, and kikuchipy's own h5ebsd format), we try to determine which of these formats the file is in by an HDF5 group name "footprint", unique to each format. The footprint of the EMsoft master pattern HDF5 file is "emdata/ebsdmaster" (capitalisation irrelevant). Can you confirm that your file has these group names? You can either do this by opening the file in an HDF5 file viewer (HDFviewer, HDFcompass [which I use]), or via Python or any other software with HDF5 support. Reading the group names of one of my EMsoft master pattern files in Python:
>>> from h5py import File
>>> f = File("/home/hakon/kode/emsoft/emdata/crystal_data/al/al_mc_mp_20kv.h5", mode="r")
>>> f.keys()
<KeysViewHDF5 ['CrystalData', 'EMData', 'EMheader', 'NMLfiles', 'NMLparameters']>
>>> f["EMData"].keys()
<KeysViewHDF5 ['EBSDmaster', 'MCOpenCL']>
This file was produced with EMsoft v4.1 ("4_1_0_1e9deab" specifically). Which EMsoft version was your master pattern created with? I haven't created a master pattern file in a year, it might be that the format has been updated. If so, we should definitely update the reader in kikuchipy!
Ah that's the problem, the file I have is a TKD master pattern. It might be useful if kikuchipy could also read such a file in, assuming it has the same structure as an EBSD master pattern?
f.keys()
>>> <KeysViewHDF5 ['CrystalData', 'EMData', 'EMheader', 'NMLfiles', 'NMLparameters']>
f["EMData"].keys()
>>> <KeysViewHDF5 ['MCfoil', 'TKDmaster']>
f["EMData"]['MCfoil'].keys()
>>> <KeysViewHDF5 ['accum_e', 'accum_e_SP', 'accum_z', 'multiplier', 'numEbins', 'numzbins', 'totnum_el']>
f["EMData"]['TKDmaster'].keys()
>>> <KeysViewHDF5 ['BetheParameters', 'EkeVs', 'lastEnergy', 'mLPNH', 'mLPSH', 'masterSPNH', 'masterSPSH', 'numEbins', 'numset', 'xtalname']>
I've written readers for EMsoft's TKD and ECP (electron channelig pattern) master patterns in a branch in my fork, which is currently part of an open PR #476. I wrote the readers because @IMBalENce wanted easy access to EMsoft's ECP master patterns. I might wrap it up and merge soon if there is interest, but in the meantime you can create a separate Python environment (e.g. with conda) and install the branch version (output omitted)
conda create -n kp-dev python=3.9
conda activate kp-dev
pip install git+https://github.com/hakonanes/kikuchipy.git@generalize-master-pattern-class
You should then be able get your TKD master pattern as an EBSDMasterPattern
just like reading an EBSD master pattern.
Apologies for yet more questions. If you would prefer I contact you in a different manor, please do say. Trying to load in an EMSoft master pattern and am getting the following error: